Closed
Description
openedon Sep 17, 2019
The following compiles:
#![feature(const_generics)]
pub fn x<const I: usize>() {}
pub fn y<const I: usize>() {
x::<{I}>();
}
And so does:
#![feature(const_generics)]
struct S;
impl S {
pub fn x() {}
pub fn y<const I: usize>() {
Self::x();
}
}
However, the following does not:
#![feature(const_generics)]
struct S;
impl S {
pub fn x<const I: usize>() {}
pub fn y<const I: usize>() {
Self::x::<{I}>();
}
}
error: internal compiler error: unexpected const parent path Expr(expr(HirId { owner: DefIndex(17), local_id: 9 }: <Self>::x::<>))
error: internal compiler error: cat_expr Errd
--> src\lib.rs:8:19
|
8 | Self::x::<{I}>();
| ^^^
error: internal compiler error: mir_const_qualif: MIR had errors
--> src\lib.rs:8:19
|
8 | Self::x::<{I}>();
| ^^^
error: internal compiler error: QualifyAndPromoteConstants: MIR had errors
--> src\lib.rs:8:19
|
8 | Self::x::<{I}>();
| ^^^
error: internal compiler error: broken MIR in DefId(0:19 ~ reproduce[b9f9]::{{impl}}[0]::y[0]::{{constant}}[0]) ("return type"): bad type [type error]
--> src\lib.rs:8:19
|
8 | Self::x::<{I}>();
| ^^^
error: internal compiler error: broken MIR in DefId(0:19 ~ reproduce[b9f9]::{{impl}}[0]::y[0]::{{constant}}[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, is_block_tail: None, ty: [type error], user_ty: UserTypeProjections { contents: [] }, name: None, source_info: SourceInfo { span: src\lib.rs:8:19: 8:22, scope: scope[0] }, visibility_scope: scope[0] }): bad type [type error]
--> src\lib.rs:8:19
|
8 | Self::x::<{I}>();
| ^^^
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src\librustc_errors\lib.rs:360:17
stack backtrace:
0: 0x7ffaeae25aa9 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb20333da0418f90f
1: 0x7ffaeae541eb - core::fmt::write::he93a8f5e9fe72b9f
2: 0x7ffaeae189a4 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hbe3650c5b670aece
3: 0x7ffaeae2a080 - std::panicking::take_hook::hb08b66bde672a629
4: 0x7ffaeae29caa - std::panicking::take_hook::hb08b66bde672a629
5: 0x7ffacd165b1b - rustc_driver::report_ice::hcb418958ffca673b
6: 0x7ffaeae2a8fd - std::panicking::rust_panic_with_hook::h7312cebf7b30fd61
7: 0x7ffacee3a8d5 - rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter::ui_testing::h250e4c9012a8a178
8: 0x7ffacee1dbe2 - <rustc_errors::Handler as core::ops::drop::Drop>::drop::h4b24e07dbae1ad74
9: 0x7ffacd1751c0 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h7e7b295ba58950ac
10: 0x7ffacd17c266 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h7e7b295ba58950ac
11: 0x7ffacd1331bc - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h42f1798a01c1f811
12: 0x7ffacd12cbb4 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h42f1798a01c1f811
13: 0x7ffacd141ba6 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h42f1798a01c1f811
14: 0x7ffacd167ed1 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h7e7b295ba58950ac
15: 0x7ffacd184409 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h7e7b295ba58950ac
16: 0x7ffacd0e513c - rustc_data_structures::graph::implementation::NodeIndex::node_id::h6bc48a6929e638bf
17: 0x7ffaeae3c9c2 - _rust_maybe_catch_panic
18: 0x7ffacd11e612 - <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt::haefe1a67821b54d1
19: 0x7ffaeae07af7 - ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
20: 0x7ffaeae3a267 - std::sys::windows::thread::Thread::new::h5c25099711a7639e
21: 0x7ffb281e4034 - BaseThreadInitThunk
22: 0x7ffb28333691 - RtlUserThreadStart
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Area: Lazy normalization (tracking issue: #60471)Category: This is a bug.`#![feature(const_generics)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.