You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was experimenting with type-checked vector space (i.e. NOT Vec) operations in Rust, and I triggered a compiler panic using a nightly version of rustc. I reproduced it with the following minimal example.
$ RUST_BACKTRACE=1 rustc panic.rs
error[E0402]: cannot use an outer type parameter in this context
--> panic.rs:14:18
|
14 | entries: [T; D::dim()]
| ^^^^^^
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https:/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: resolution.depth == 0 || resolution.base_def != Def::Err', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_resolve/lib.rs:3057
stack backtrace:
1: 0x7f6ce27e245c - std::sys::imp::backtrace::tracing::imp::write::hf7294f5e24536b4a
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
2: 0x7f6ce27f090e - std::panicking::default_hook::{{closure}}::h9a07d0b00c43fbee
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:351
3: 0x7f6ce27f04b3 - std::panicking::default_hook::hf25feff2d08bf39b
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:361
4: 0x7f6ce27f0dab - std::panicking::rust_panic_with_hook::h4cb8c6fbb8386ccf
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:555
5: 0x7f6ce1c1f5df - std::panicking::begin_panic::hf1b80a6a0e51b6b9
6: 0x7f6ce1cadab7 - rustc_resolve::Resolver::record_def::h15236138b24715a8
7: 0x7f6ce1ca392f - rustc_resolve::Resolver::smart_resolve_path_fragment::h1fa53ba27ab9a109
8: 0x7f6ce1ca323e - rustc_resolve::Resolver::smart_resolve_path::h13f47097f2a193db
9: 0x7f6ce1cac5ec - rustc_resolve::Resolver::resolve_expr::hf3d20230b68f4493
10: 0x7f6ce1cabdc2 - rustc_resolve::Resolver::resolve_expr::hf3d20230b68f4493
11: 0x7f6ce1c92a99 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_ty::hb5b693f9b7bbf593
12: 0x7f6ce1c6c13a - syntax::visit::walk_item::h252471301ef1c7d3
13: 0x7f6ce1c9d948 - rustc_resolve::Resolver::resolve_item::h2d1f35e3feef0866
14: 0x7f6ce1c9629f - rustc_resolve::Resolver::resolve_crate::h17a2aa2bf4f16732
15: 0x7f6ce2b7d7ec - rustc_driver::driver::phase_2_configure_and_expand::{{closure}}::h69863e9637c42976
16: 0x7f6ce2b765a8 - rustc_driver::driver::phase_2_configure_and_expand::h026284537f8f8432
17: 0x7f6ce2b6d37a - rustc_driver::driver::compile_input::hab977ae496b3a6f1
18: 0x7f6ce2bb99c4 - rustc_driver::run_compiler::h81290683db66a63c
19: 0x7f6ce2ac5deb - std::panicking::try::do_call::h00942d7a5d04424f
20: 0x7f6ce27f9bea - __rust_maybe_catch_panic
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
21: 0x7f6ce2aee052 - <F as alloc::boxed::FnBox<A>>::call_box::hd87f7ab2fccbd670
22: 0x7f6ce27ef764 - std::sys::imp::thread::Thread::new::thread_start::hc16926852e47c008
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/liballoc/boxed.rs:623
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys_common/thread.rs:21
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/thread.rs:84
23: 0x7f6cda5d6453 - start_thread
24: 0x7f6ce24b27de - __GI___clone
25: 0x0 - <unknown>
Ostensibly the error is expected but the panic is not. It seems to be something about the vector struct definition that's causing rustc to panic, because when I remove the vector code, the compiler panic goes away.
@eddyb found this too (#38154 (comment)) and disabled the assert, but this should be preventively fixed somewhere in resolve_path instead, IMO.
(Added this to my work queue.)
I was experimenting with type-checked vector space (i.e. NOT
Vec
) operations in Rust, and I triggered a compiler panic using a nightly version ofrustc
. I reproduced it with the following minimal example.Using
gave me an error I basically expected
but when I switched to
rustc-nightly
I triggered the following compiler panic.
Ostensibly the error is expected but the panic is not. It seems to be something about the vector struct definition that's causing
rustc
to panic, because when I remove the vector code, the compiler panic goes away.Using the same
rustc-nightly
as before, the following happens.as expected. Interestingly,
rustc
throws a different compiler error before it panics as well. I am not sure if that's relevant or not though.The text was updated successfully, but these errors were encountered: