Closed
Description
The following code produces several ICEs on both beta and nightly (no #![feature]
necessary).
Code
#![crate_type = "lib"]
trait A {
type T: B<U<1i32> = ()>;
}
trait B {
type U<const C: i32>;
}
Meta
rustc -Vv
:
rustc 1.66.0-nightly (9062b780b 2022-09-21)
binary: rustc
commit-hash: 9062b780b32d2eab060b4432863e085d9504ca5c
commit-date: 2022-09-21
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.0
Error output
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: Could not find associated const on trait
|
= note: delayed at compiler/rustc_typeck/src/collect/type_of.rs:442:27
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler/rustc_typeck/src/check/coercion.rs:176:49
error: internal compiler error: `InferCtxt` incorrectly tainted by errors
|
= note: delayed at compiler/rustc_infer/src/infer/mod.rs:1281:27
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler/rustc_mir_build/src/build/mod.rs:627:18
error: internal compiler error: mir_const_qualif: MIR had errors
--> ice.rs:4:17
|
4 | type T: B<U<1i32> = ()>;
| ^^^^
|
= note: delayed at compiler/rustc_mir_transform/src/lib.rs:252:18
error: internal compiler error: PromoteTemps: MIR had errors
--> ice.rs:4:17
|
4 | type T: B<U<1i32> = ()>;
| ^^^^
|
= note: delayed at compiler/rustc_const_eval/src/transform/promote_consts.rs:52:22
error: internal compiler error: broken MIR in DefId(0:5 ~ ice[8829]::A::T::{constant#0}) ("return type"): bad type [type error]
--> ice.rs:4:17
|
4 | type T: B<U<1i32> = ()>;
| ^^^^
|
= note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:517:13
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:785:20
error: internal compiler error: broken MIR in DefId(0:5 ~ ice[8829]::A::T::{constant#0}) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: ice.rs:4:17: 4:21 (#0), scope: scope[0] } }): bad type [type error]
--> ice.rs:4:17
|
4 | type T: B<U<1i32> = ()>;
| ^^^^
|
= note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:517:13
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1530:13
Backtrace
stack backtrace:
0: 0x7f897976e010 - std::backtrace_rs::backtrace::libunwind::trace::hb70cd2c4f10319c4
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7f897976e010 - std::backtrace_rs::backtrace::trace_unsynchronized::h6a235690bde8066a
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f897976e010 - std::sys_common::backtrace::_print_fmt::hf423a9f93de17924
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7f897976e010 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h81fafbb534b53ab7
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7f89797c8e5e - core::fmt::write::h91215ed98af09b40
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/core/src/fmt/mod.rs:1202:17
5: 0x7f897975eb15 - std::io::Write::write_fmt::h9d32a42fc3233c10
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/io/mod.rs:1679:15
6: 0x7f8979770d93 - std::sys_common::backtrace::_print::hebe110643c78e1a1
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7f8979770d93 - std::sys_common::backtrace::print::h544b1b31fddff6eb
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7f8979770d93 - std::panicking::default_hook::{{closure}}::hf97dcba6b32ea332
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:267:22
9: 0x7f8979770a7f - std::panicking::default_hook::h3f82dc02801e0576
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:286:9
10: 0x7f897bf748d1 - <rustc_driver[610c3dabcb482a3]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[c7389bc70673082e]::ops::function::FnOnce<(&core[c7389bc70673082e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
11: 0x7f89797715cb - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1442642a89018d6d
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/alloc/src/boxed.rs:1954:9
12: 0x7f89797715cb - std::panicking::rust_panic_with_hook::hb8c8dca0bdad40db
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:673:13
13: 0x7f897d0917d1 - std[2c19137f19a9cec7]::panicking::begin_panic::<rustc_errors[275d4fb119ffacfb]::ExplicitBug>::{closure#0}
14: 0x7f897d091536 - std[2c19137f19a9cec7]::sys_common::backtrace::__rust_end_short_backtrace::<std[2c19137f19a9cec7]::panicking::begin_panic<rustc_errors[275d4fb119ffacfb]::ExplicitBug>::{closure#0}, !>
15: 0x7f897d0911d6 - std[2c19137f19a9cec7]::panicking::begin_panic::<rustc_errors[275d4fb119ffacfb]::ExplicitBug>
16: 0x7f897d08e9b6 - std[2c19137f19a9cec7]::panic::panic_any::<rustc_errors[275d4fb119ffacfb]::ExplicitBug>
17: 0x7f897ba92c4b - <rustc_errors[275d4fb119ffacfb]::HandlerInner as core[c7389bc70673082e]::ops::drop::Drop>::drop
18: 0x7f897ad4f778 - core[c7389bc70673082e]::ptr::drop_in_place::<rustc_session[40303a05d79b8f9]::parse::ParseSess>
19: 0x7f897ad0d6d8 - <alloc[9a4df20b0dad2694]::rc::Rc<rustc_session[40303a05d79b8f9]::session::Session> as core[c7389bc70673082e]::ops::drop::Drop>::drop
20: 0x7f897ad0a2ed - core[c7389bc70673082e]::ptr::drop_in_place::<rustc_interface[121647ee48321f2a]::interface::Compiler>
21: 0x7f897ad07b74 - rustc_interface[121647ee48321f2a]::interface::create_compiler_and_run::<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>
22: 0x7f897ad06072 - <scoped_tls[d2720ff23ff3c466]::ScopedKey<rustc_span[d840d66cf15b0e9]::SessionGlobals>>::set::<rustc_interface[121647ee48321f2a]::interface::run_compiler<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>
23: 0x7f897ad05d5f - std[2c19137f19a9cec7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[121647ee48321f2a]::util::run_in_thread_pool_with_globals<rustc_interface[121647ee48321f2a]::interface::run_compiler<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>
24: 0x7f897bdda9d0 - <<std[2c19137f19a9cec7]::thread::Builder>::spawn_unchecked_<rustc_interface[121647ee48321f2a]::util::run_in_thread_pool_with_globals<rustc_interface[121647ee48321f2a]::interface::run_compiler<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>::{closure#1} as core[c7389bc70673082e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
25: 0x7f897977b3b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he225f53d02ef001f
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/alloc/src/boxed.rs:1940:9
26: 0x7f897977b3b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1d16365b1f15b7b7
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/alloc/src/boxed.rs:1940:9
27: 0x7f897977b3b3 - std::sys::unix::thread::Thread::new::thread_start::h91bd867cccfe281f
at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys/unix/thread.rs:108:17
28: 0x7f897951f78d - <unknown>
29: 0x7f89795a08e4 - clone
30: 0x0 - <unknown>
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.66.0-nightly (9062b780b 2022-09-21) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
@rustbot label F-generic_associated_types A-const-generics
Metadata
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(generic_associated_types)]` a.k.a. GATsIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.