Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: no entry found for key generics_of.rs #113017

Closed
matthiaskrgr opened this issue Jun 25, 2023 · 6 comments · Fixed by #122863
Closed

ICE: no entry found for key generics_of.rs #113017

matthiaskrgr opened this issue Jun 25, 2023 · 6 comments · Fixed by #122863
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 25, 2023

Code

#![feature(generic_const_exprs)]

pub fn String<V>(elem)
where
    V: 'a,
    for<const N: usize = { || {}}> V: 'a, 
    for<C2: , R2, R3: > <&str as IntoIterator>::Item: 'static,
{}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (22e9fe644 2023-06-23)
binary: rustc
commit-hash: 22e9fe644ea710eec50cb0aabcae7fa8dd9fd675
commit-date: 2023-06-23
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

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 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::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 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::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::<rustc_query_impl[30672f8f3d90a755]::query_impl::generics_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 8usize]>>
  23:     0x7f2309efa930 - <rustc_query_impl[30672f8f3d90a755]::query_impl::generics_of::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, rustc_span[8155bebf48a1eb91]::def_id::DefId)>>::call_once
  24:     0x7f230963d515 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::DefaultCache<rustc_span[8155bebf48a1eb91]::def_id::DefId, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 8usize]>>, 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::<rustc_query_impl[30672f8f3d90a755]::query_impl::generics_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f2309efa930 - <rustc_query_impl[30672f8f3d90a755]::query_impl::generics_of::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, rustc_span[8155bebf48a1eb91]::def_id::DefId)>>::call_once
  29:     0x7f230963d515 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::DefaultCache<rustc_span[8155bebf48a1eb91]::def_id::DefId, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 8usize]>>, 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 - <rustc_hir_analysis[bed39c5e84d3e350]::collect::CollectItemTypesVisitor as rustc_hir[f5b2dc8658a8d394]::intravisit::Visitor>::visit_expr
  32:     0x7f2309673676 - <rustc_hir_analysis[bed39c5e84d3e350]::collect::CollectItemTypesVisitor as rustc_hir[f5b2dc8658a8d394]::intravisit::Visitor>::visit_expr
  33:     0x7f230979d0e9 - <rustc_hir_analysis[bed39c5e84d3e350]::collect::CollectItemTypesVisitor as rustc_hir[f5b2dc8658a8d394]::intravisit::Visitor>::visit_generics
  34:     0x7f2309ed26eb - rustc_hir[f5b2dc8658a8d394]::intravisit::walk_item::<rustc_hir_analysis[bed39c5e84d3e350]::collect::CollectItemTypesVisitor>
  35:     0x7f2309ed03dd - <rustc_hir_analysis[bed39c5e84d3e350]::collect::CollectItemTypesVisitor as rustc_hir[f5b2dc8658a8d394]::intravisit::Visitor>::visit_item
  36:     0x7f2309eccc43 - rustc_hir_analysis[bed39c5e84d3e350]::collect::collect_mod_item_types
  37:     0x7f230a2d6aec - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[30672f8f3d90a755]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 0usize]>>
  38:     0x7f230a2d6ace - <rustc_query_impl[30672f8f3d90a755]::query_impl::collect_mod_item_types::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, rustc_span[8155bebf48a1eb91]::def_id::LocalDefId)>>::call_once
  39:     0x7f2309cf518f - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::VecCache<rustc_span[8155bebf48a1eb91]::def_id::LocalDefId, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 0usize]>>, 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 - <rustc_middle[aeb3147772634dcd]::hir::map::Map>::for_each_module::<rustc_hir_analysis[bed39c5e84d3e350]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  42:     0x7f230aa98752 - <rustc_session[91ea302e4bbb4392]::session::Session>::track_errors::<rustc_hir_analysis[bed39c5e84d3e350]::check_crate::{closure#0}, ()>
  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::<rustc_query_impl[30672f8f3d90a755]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 1usize]>>
  46:     0x7f230aadc829 - <rustc_query_impl[30672f8f3d90a755]::query_impl::analysis::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, ())>>::call_once
  47:     0x7f230ac71c18 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::SingleCache<rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 1usize]>>, 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 - <rustc_middle[aeb3147772634dcd]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
  50:     0x7f230a803f4b - <rustc_interface[3e44238a9783f3c8]::interface::Compiler>::enter::<rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}::{closure#2}, core[db7c5f9f8e26b951]::result::Result<core[db7c5f9f8e26b951]::option::Option<rustc_interface[3e44238a9783f3c8]::queries::Linker>, rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
  51:     0x7f230a7ffd99 - rustc_span[8155bebf48a1eb91]::set_source_map::<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  52:     0x7f230a7ff8c5 - <scoped_tls[5f3106920672553]::ScopedKey<rustc_span[8155bebf48a1eb91]::SessionGlobals>>::set::<rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, 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_interface[3e44238a9783f3c8]::util::run_in_thread_pool_with_globals<rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, 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 - <<std[590ba7ead67831d4]::thread::Builder>::spawn_unchecked_<rustc_interface[3e44238a9783f3c8]::util::run_in_thread_pool_with_globals<rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, 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 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2e6f8aee19cb9bca
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:1993:9
  56:     0x7f2308375695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::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 - <unknown>
  59:     0x7f2308190e40 - <unknown>
  60:                0x0 - <unknown>

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`.

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Jun 25, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 25, 2023
@matthiaskrgr
Copy link
Member Author

Crashes since at least stable rustc 1.60.0.
Wish we could prevent unstable features from leaking ices into the stable line somehow :/

@workingjubilee
Copy link
Contributor

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.

@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 25, 2023

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

@asquared31415
Copy link
Contributor

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.

@workingjubilee
Copy link
Contributor

workingjubilee commented Jun 26, 2023

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!

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 27, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 14, 2023
@obeis obeis removed their assignment Jul 19, 2023
@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jan 3, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 22, 2024
@bors bors closed this as completed in b0e1008 Mar 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 22, 2024
Rollup merge of rust-lang#122863 - matthiaskrgr:teest, r=lcnr

add more ice tests

fixes rust-lang#119275
fixes rust-lang#113017
fixes rust-lang#112824
fixes rust-lang#112823
fixes rust-lang#121472
fixes rust-lang#110696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants