Skip to content

ICE: no entry found for key for const function in generic_const_exprs #113133

Closed
@TaKO8Ki

Description

@TaKO8Ki

Code

#![allow(incomplete_features)]
#![feature(generic_const_exprs, non_lifetime_binders)]

pub fn foo()
where
    for<const N: usize = { const fn bar() {} bar(); 1 }> ():, 
{}

fn main() {}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=0d1b045cfc1c048025e6ef2330d9179b

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (37998ab50 2023-06-11)
binary: rustc
commit-hash: 37998ab508d5d9fa0d465d7b535dc673087dda8f
commit-date: 2023-06-11
host: aarch64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

<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:        0x105700b00 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h67295a55357b9ea8
   1:        0x105750c54 - core::fmt::write::hb082eb2eab9a1fb9
   2:        0x1056f6c7c - std::io::Write::write_fmt::hfb48ee859c189b95
   3:        0x105700954 - std::sys_common::backtrace::print::h0a9e61783963c135
   4:        0x1057033dc - std::panicking::default_hook::{{closure}}::hb55f2bd4dc452498
   5:        0x1057031e4 - std::panicking::default_hook::h51e5d3223e3d53ac
   6:        0x10dc51c20 - rustc_driver_impl[cf944b933bd3cbcf]::install_ice_hook::{closure#0}
   7:        0x105703a90 - std::panicking::rust_panic_with_hook::h405822586be2913b
   8:        0x105703870 - std::panicking::begin_panic_handler::{{closure}}::ha651054046bf6cba
   9:        0x105700ee0 - std::sys_common::backtrace::__rust_end_short_backtrace::h25f2d47492d88731
  10:        0x1057035e4 - _rust_begin_unwind
  11:        0x10577bed4 - core::panicking::panic_fmt::h752dd8321211099f
  12:        0x10577bea0 - core::option::expect_failed::hec3a9257c8fefa89
  13:        0x11020c2a0 - rustc_hir_analysis[4e376d8be9d07597]::collect::generics_of::generics_of
  14:        0x110f3db18 - rustc_query_impl[af3533fea9d33d1c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af3533fea9d33d1c]::query_impl::generics_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 8usize]>>
  15:        0x110e6cb64 - <rustc_query_impl[af3533fea9d33d1c]::query_impl::generics_of::dynamic_query::{closure#2} as core[b14c91cbd9e59259]::ops::function::FnOnce<(rustc_middle[eaa4ae2c50011b3f]::ty::context::TyCtxt, rustc_span[81ec719996044981]::def_id::DefId)>>::call_once
  16:        0x110dbd3b4 - rustc_query_system[5ebd624b0611727f]::query::plumbing::try_execute_query::<rustc_query_impl[af3533fea9d33d1c]::DynamicConfig<rustc_query_system[5ebd624b0611727f]::query::caches::DefaultCache<rustc_span[81ec719996044981]::def_id::DefId, rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[af3533fea9d33d1c]::plumbing::QueryCtxt, true>
  17:        0x110fa1984 - rustc_query_impl[af3533fea9d33d1c]::query_impl::generics_of::get_query_incr::__rust_end_short_backtrace
  18:        0x110af7e14 - rustc_middle[eaa4ae2c50011b3f]::query::plumbing::query_get_at::<rustc_query_system[5ebd624b0611727f]::query::caches::DefaultCache<rustc_span[81ec719996044981]::def_id::DefId, rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 8usize]>>>
  19:        0x110af5b28 - <rustc_middle[eaa4ae2c50011b3f]::ty::list::List<rustc_middle[eaa4ae2c50011b3f]::ty::subst::GenericArg>>::identity_for_item::<rustc_span[81ec719996044981]::def_id::DefId>
  20:        0x110af0ce0 - rustc_borrowck[98be8dd7584271d9]::nll::replace_regions_in_mir
  21:        0x110a15b30 - rustc_borrowck[98be8dd7584271d9]::do_mir_borrowck
  22:        0x110a09f40 - rustc_borrowck[98be8dd7584271d9]::mir_borrowck
  23:        0x110f3dfb8 - rustc_query_impl[af3533fea9d33d1c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af3533fea9d33d1c]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 8usize]>>
  24:        0x110e6d644 - <rustc_query_impl[af3533fea9d33d1c]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[b14c91cbd9e59259]::ops::function::FnOnce<(rustc_middle[eaa4ae2c50011b3f]::ty::context::TyCtxt, rustc_span[81ec719996044981]::def_id::LocalDefId)>>::call_once
  25:        0x110de55d0 - rustc_query_system[5ebd624b0611727f]::query::plumbing::try_execute_query::<rustc_query_impl[af3533fea9d33d1c]::DynamicConfig<rustc_query_system[5ebd624b0611727f]::query::caches::VecCache<rustc_span[81ec719996044981]::def_id::LocalDefId, rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[af3533fea9d33d1c]::plumbing::QueryCtxt, true>
  26:        0x110e08948 - rustc_query_impl[af3533fea9d33d1c]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  27:        0x10dc743d8 - <core[b14c91cbd9e59259]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[c47d023ad17f7c14]::sync::par_for_each_in<&[rustc_span[81ec719996044981]::def_id::LocalDefId], <rustc_middle[eaa4ae2c50011b3f]::hir::map::Map>::par_body_owners<rustc_interface[5b42c0403b11871c]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}> as core[b14c91cbd9e59259]::ops::function::FnOnce<()>>::call_once
  28:        0x10dc92470 - rustc_data_structures[c47d023ad17f7c14]::sync::par_for_each_in::<&[rustc_span[81ec719996044981]::def_id::LocalDefId], <rustc_middle[eaa4ae2c50011b3f]::hir::map::Map>::par_body_owners<rustc_interface[5b42c0403b11871c]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>
  29:        0x10dcee298 - <rustc_session[4144d3c28bdb63cb]::session::Session>::time::<(), rustc_interface[5b42c0403b11871c]::passes::analysis::{closure#1}>
  30:        0x10dd08afc - rustc_interface[5b42c0403b11871c]::passes::analysis
  31:        0x110f423b0 - rustc_query_impl[af3533fea9d33d1c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af3533fea9d33d1c]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 1usize]>>
  32:        0x110ef44ec - <rustc_query_impl[af3533fea9d33d1c]::query_impl::analysis::dynamic_query::{closure#2} as core[b14c91cbd9e59259]::ops::function::FnOnce<(rustc_middle[eaa4ae2c50011b3f]::ty::context::TyCtxt, ())>>::call_once
  33:        0x110d920bc - rustc_query_system[5ebd624b0611727f]::query::plumbing::try_execute_query::<rustc_query_impl[af3533fea9d33d1c]::DynamicConfig<rustc_query_system[5ebd624b0611727f]::query::caches::SingleCache<rustc_middle[eaa4ae2c50011b3f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[af3533fea9d33d1c]::plumbing::QueryCtxt, true>
  34:        0x110e39c18 - rustc_query_impl[af3533fea9d33d1c]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  35:        0x10dbfdc14 - <rustc_interface[5b42c0403b11871c]::queries::QueryResult<&rustc_middle[eaa4ae2c50011b3f]::ty::context::GlobalCtxt>>::enter::<core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>, rustc_driver_impl[cf944b933bd3cbcf]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  36:        0x10dc2e11c - <rustc_interface[5b42c0403b11871c]::interface::Compiler>::enter::<rustc_driver_impl[cf944b933bd3cbcf]::run_compiler::{closure#1}::{closure#2}, core[b14c91cbd9e59259]::result::Result<core[b14c91cbd9e59259]::option::Option<rustc_interface[5b42c0403b11871c]::queries::Linker>, rustc_span[81ec719996044981]::ErrorGuaranteed>>
  37:        0x10dbf8d40 - rustc_span[81ec719996044981]::set_source_map::<core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>, rustc_interface[5b42c0403b11871c]::interface::run_compiler<core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>, rustc_driver_impl[cf944b933bd3cbcf]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  38:        0x10dbeebc0 - <scoped_tls[f8f4f3c4b0fbbc6d]::ScopedKey<rustc_span[81ec719996044981]::SessionGlobals>>::set::<rustc_interface[5b42c0403b11871c]::interface::run_compiler<core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>, rustc_driver_impl[cf944b933bd3cbcf]::run_compiler::{closure#1}>::{closure#0}, core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>>
  39:        0x10dbfbe90 - std[3869d83b3247aa61]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5b42c0403b11871c]::util::run_in_thread_pool_with_globals<rustc_interface[5b42c0403b11871c]::interface::run_compiler<core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>, rustc_driver_impl[cf944b933bd3cbcf]::run_compiler::{closure#1}>::{closure#0}, core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>>
  40:        0x10dbec398 - <<std[3869d83b3247aa61]::thread::Builder>::spawn_unchecked_<rustc_interface[5b42c0403b11871c]::util::run_in_thread_pool_with_globals<rustc_interface[5b42c0403b11871c]::interface::run_compiler<core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>, rustc_driver_impl[cf944b933bd3cbcf]::run_compiler::{closure#1}>::{closure#0}, core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b14c91cbd9e59259]::result::Result<(), rustc_span[81ec719996044981]::ErrorGuaranteed>>::{closure#1} as core[b14c91cbd9e59259]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:        0x10570c49c - std::sys::unix::thread::Thread::new::thread_start::h8efa39cbe420b54d
  42:        0x1894ba26c - __pthread_deallocate

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 (37998ab50 2023-06-11) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [generics_of] computing generics of `foo::{constant#0}`
#1 [mir_borrowck] borrow-checking `foo::{constant#0}`
#2 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall 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)]`F-non_lifetime_binders`#![feature(non_lifetime_binders)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions