Closed
Description
I tried this code:
trait Thing {}
impl<T> Thing for Option<T> where T: !u64 {}
Now, I realize that that's invalid code, but I expected an error message instead of a panic?
For example, rustfmt
reports:
error: expected one of `(`, `,`, `?`, `for`, `{`, lifetime, or path, found `!`
--> /Users/rives/Projects/gobbldygook-area-auditor/foo.rs:3:38
|
3 | impl<T> Thing for Option<T> where T: !u64 {}
| ^ expected one of 7 possible tokens here
Meta
rustup run nightly -- rustc --version --verbose
:
rustc 1.35.0-nightly (2a65cbe 2019-03-08)
binary: rustc
commit-hash: 2a65cbe
commit-date: 2019-03-08
host: x86_64-apple-darwin
release: 1.35.0-nightly
LLVM version: 8.0
Backtrace:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::continue_panic_fmt
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::panicking::panic
9: syntax::parse::parser::Parser::parse_generic_bounds_common
10: syntax::parse::parser::Parser::parse_where_clause
11: syntax::parse::parser::Parser::parse_item_implementation
12: syntax::parse::parser::Parser::parse_item_
13: syntax::parse::parser::Parser::parse_item
14: syntax::parse::parser::Parser::parse_mod_items
15: syntax::parse::parser::Parser::parse_crate_mod
16: syntax::parse::parse_crate_from_file
17: rustc_driver::driver::phase_1_parse_input::{{closure}}
18: rustc::util::common::time
19: rustc_driver::driver::phase_1_parse_input
20: rustc_driver::driver::compile_input
21: rustc_driver::run_compiler_with_pool
22: <scoped_tls::ScopedKey<T>>::set
23: rustc_driver::run_compiler
24: syntax::with_globals
25: __rust_maybe_catch_panic
26: <F as alloc::boxed::FnBox<A>>::call_box
27: std::sys::unix::thread::Thread::new::thread_start
28: _pthread_body
29: _pthread_start
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.35.0-nightly (2a65cbeea 2019-03-08) running on x86_64-apple-darwin