Closed matthiaskrgr closed 7 months ago
Crashes since at least stable rustc 1.60.0
.
Wish we could prevent unstable features from leaking ices into the stable line somehow :/
It would be very easy to do that if rustc decided to stop providing the quality of diagnostics that it does, and e.g. simply collected all parse errors and printed them for the user. Instead, it looks at utterly nonsensical input and tries to keep going so it can offer help.
pub fn foo()
where
for<const N: usize = { || {}; 1 }> ():,
{}
seems to be a more minimal repro (although its hard to tell from just the backtraces whether its the same underlying cause) If you add feature(generic_const_exprs)
its the same ICE as in the issue descr
That appears to be a different ICE message on stable 1.70.0 than when the feature is enabled, not sure if that is relevant here.
It ices in the same point of the code, generics_of.rs:88:41
, given
#![feature(generic_const_exprs)]
pub fn foo()
where
for<const N: usize = { || {}; 1 }> ():,
{}
EDIT: cat!
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-medium
Code
Meta
rustc --version --verbose
:Error output
Backtrace
``` thread 'rustc' panicked at 'no entry found for key', compiler/rustc_hir_analysis/src/collect/generics_of.rs:88:41 stack backtrace: 0: 0x7f2308367e31 - std::backtrace_rs::backtrace::libunwind::trace::h45c8b5b393354aaa at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f2308367e31 - std::backtrace_rs::backtrace::trace_unsynchronized::hc5cde6aeff03cc23 at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f2308367e31 - std::sys_common::backtrace::_print_fmt::h86fd79bdeff6c899 at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7f2308367e31 -::fmt::h0f1168665e8c8865
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f23083c95df - core::fmt::rt::Argument::fmt::hfed1a51422c978b7
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/fmt/rt.rs:138:9
5: 0x7f23083c95df - core::fmt::write::h4dfc2a0c62cf3fd6
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/fmt/mod.rs:1094:21
6: 0x7f230835a967 - std::io::Write::write_fmt::ha45cc30dd6a81686
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/io/mod.rs:1714:15
7: 0x7f2308367c45 - std::sys_common::backtrace::_print::h14294ae8d055d04e
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f2308367c45 - std::sys_common::backtrace::print::hf007ea148056754d
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f230836a9f3 - std::panicking::default_hook::{{closure}}::h12f0e86c17019fae
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:269:22
10: 0x7f230836a784 - std::panicking::default_hook::h3e363e70e8823128
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:288:9
11: 0x7f230b603eab - rustc_driver_impl[1ee18bc64acaad37]::install_ice_hook::{closure#0}
12: 0x7f230836b21e - as core::ops::function::Fn>::call::h6345ba7ef09e0a3b
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:2007:9
13: 0x7f230836b21e - std::panicking::rust_panic_with_hook::he3112cb9ec41f5a5
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:709:13
14: 0x7f230836afa7 - std::panicking::begin_panic_handler::{{closure}}::ha789ef310202fe47
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:597:13
15: 0x7f2308368266 - std::sys_common::backtrace::__rust_end_short_backtrace::h455eb16e2038ff87
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:151:18
16: 0x7f230836acf2 - rust_begin_unwind
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:593:5
17: 0x7f23083c5833 - core::panicking::panic_fmt::h911f0f6c6f3e2e92
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/panicking.rs:67:14
18: 0x7f23083c5593 - core::panicking::panic_display::h474868786ec72e4f
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/panicking.rs:150:5
19: 0x7f23083c5593 - core::panicking::panic_str::h44f3789074067b1e
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/panicking.rs:134:5
20: 0x7f23083c5593 - core::option::expect_failed::h3a7a4c408a01161b
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/option.rs:1952:5
21: 0x7f2309efe68c - rustc_hir_analysis[bed39c5e84d3e350]::collect::generics_of::generics_of
22: 0x7f2309efa998 - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::>
23: 0x7f2309efa930 - >::call_once
24: 0x7f230963d515 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, false>
25: 0x7f230af6e963 - rustc_query_impl[30672f8f3d90a755]::query_impl::generics_of::get_query_non_incr::__rust_end_short_backtrace
26: 0x7f2309efc2fd - rustc_hir_analysis[bed39c5e84d3e350]::collect::generics_of::generics_of
27: 0x7f2309efa998 - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::>
28: 0x7f2309efa930 - >::call_once
29: 0x7f230963d515 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, false>
30: 0x7f230af6e963 - rustc_query_impl[30672f8f3d90a755]::query_impl::generics_of::get_query_non_incr::__rust_end_short_backtrace
31: 0x7f230967380b - ::visit_expr
32: 0x7f2309673676 - ::visit_expr
33: 0x7f230979d0e9 - ::visit_generics
34: 0x7f2309ed26eb - rustc_hir[f5b2dc8658a8d394]::intravisit::walk_item::
35: 0x7f2309ed03dd - ::visit_item
36: 0x7f2309eccc43 - rustc_hir_analysis[bed39c5e84d3e350]::collect::collect_mod_item_types
37: 0x7f230a2d6aec - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::>
38: 0x7f230a2d6ace - >::call_once
39: 0x7f2309cf518f - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, false>
40: 0x7f230af7fd14 - rustc_query_impl[30672f8f3d90a755]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
41: 0x7f230aa98b77 - ::for_each_module::
42: 0x7f230aa98752 - ::track_errors::
43: 0x7f230aa96f51 - rustc_hir_analysis[bed39c5e84d3e350]::check_crate
44: 0x7f230aa8fb6a - rustc_interface[3e44238a9783f3c8]::passes::analysis
45: 0x7f230aadc83a - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::>
46: 0x7f230aadc829 - >::call_once
47: 0x7f230ac71c18 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, false>
48: 0x7f230ac719e9 - rustc_query_impl[30672f8f3d90a755]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
49: 0x7f230ac28485 - ::enter::>
50: 0x7f230a803f4b - ::enter::, rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
51: 0x7f230a7ffd99 - rustc_span[8155bebf48a1eb91]::set_source_map::, rustc_interface[3e44238a9783f3c8]::interface::run_compiler, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
52: 0x7f230a7ff8c5 - >::set::, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
53: 0x7f230a7feee6 - std[590ba7ead67831d4]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
54: 0x7f230ae73945 - <::spawn_unchecked_, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>::{closure#1} as core[db7c5f9f8e26b951]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
55: 0x7f2308375695 - as core::ops::function::FnOnce>::call_once::h2e6f8aee19cb9bca
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:1993:9
56: 0x7f2308375695 - as core::ops::function::FnOnce>::call_once::h4548c5cdbeb5a136
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:1993:9
57: 0x7f2308375695 - std::sys::unix::thread::Thread::new::thread_start::h57734a91bfb8a041
at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys/unix/thread.rs:108:17
58: 0x7f230810d44b -
59: 0x7f2308190e40 -
60: 0x0 -
error: 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.72.0-nightly (22e9fe644 2023-06-23) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [generics_of] computing generics of `String::{constant#0}`
#1 [generics_of] computing generics of `String::{constant#0}::{closure#0}`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0261, E0601, E0637, E0658.
For more information about an error, try `rustc --explain E0261`.
```