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: closures: no entry found for key #117886

Closed
matthiaskrgr opened this issue Nov 13, 2023 · 2 comments · Fixed by #117884
Closed

ICE: closures: no entry found for key #117886

matthiaskrgr opened this issue Nov 13, 2023 · 2 comments · Fixed by #117884
Labels
C-bug Category: This is a bug. 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.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

trait Foo {
    fn test() -> impl Fn(u32) -> u32 {
        || x.count_ones()
    }
}

original:

// compile-flags: -Ztrait-solver=next
// check-pass

trait Foo {
    fn test() -> impl Fn(u32) -> u32 {
        || x.count_ones()
    }
}

fn test() -> impl Fn(u32) -> u32 {
        |x| x.count_ones()
    }

Version information

rustc 1.76.0-nightly (1ab2bcda4 2023-11-13)
binary: rustc
commit-hash: 1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2
commit-date: 2023-11-13
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0425]: cannot find value `x` in this scope
 --> /tmp/icemaker_global_tempdir.fsYCHepUila8/rustc_testrunner_tmpdir_reporting.iEesmi5L3ZBB/mvce.rs:3:12
  |
3 |         || x.count_ones()
  |            ^ not found in this scope

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.fsYCHepUila8/rustc_testrunner_tmpdir_reporting.iEesmi5L3ZBB/mvce.rs:5:2
  |
5 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.fsYCHepUila8/rustc_testrunner_tmpdir_reporting.iEesmi5L3ZBB/mvce.rs`

error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
 --> /tmp/icemaker_global_tempdir.fsYCHepUila8/rustc_testrunner_tmpdir_reporting.iEesmi5L3ZBB/mvce.rs:2:18
  |
2 |     fn test() -> impl Fn(u32) -> u32 {
  |                  ^^^^^^^^^^^^^^^^^^^ expected closure that takes 1 argument
3 |         || x.count_ones()
  |         -- takes 0 arguments
  |
help: consider changing the closure to take and ignore the expected argument
  |
3 |         |_| x.count_ones()
  |         ~~~

thread 'rustc' panicked at compiler/rustc_middle/src/ty/closure.rs:262:62:
no entry found for key
stack backtrace:
   0:     0x7f6cbebc461c - std::backtrace_rs::backtrace::libunwind::trace::h02700d0b9106f6ee
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f6cbebc461c - std::backtrace_rs::backtrace::trace_unsynchronized::h47697d498917cc3a
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6cbebc461c - std::sys_common::backtrace::_print_fmt::h61e153e4a9281095
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f6cbebc461c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h19e4154d0ad4df85
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f6cbec17620 - core::fmt::rt::Argument::fmt::hff5f47072cf5d938
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/core/src/fmt/rt.rs:142:9
   5:     0x7f6cbec17620 - core::fmt::write::he88bb017eb7320eb
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f6cbebb84af - std::io::Write::write_fmt::he5d70b9e85592aa1
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/io/mod.rs:1762:15
   7:     0x7f6cbebc4404 - std::sys_common::backtrace::_print::h0f9eda7450aa4845
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f6cbebc4404 - std::sys_common::backtrace::print::h2824fde3c1bc9cf4
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f6cbebc7097 - std::panicking::default_hook::{{closure}}::h1805dbb298de9c25
  10:     0x7f6cbebc6dff - std::panicking::default_hook::ha21d0b6721dee8b1
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/panicking.rs:292:9
  11:     0x7f6cbb8ef240 - std[ebdb09ff591878d7]::panicking::update_hook::<alloc[22a98c5663efe855]::boxed::Box<rustc_driver_impl[5634551524408def]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f6cbebc77d8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha9c965637066c11f
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/alloc/src/boxed.rs:2021:9
  13:     0x7f6cbebc77d8 - std::panicking::rust_panic_with_hook::hc95115aac9b43978
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/panicking.rs:783:13
  14:     0x7f6cbebc752e - std::panicking::begin_panic_handler::{{closure}}::hadf007604e83e37e
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/panicking.rs:657:13
  15:     0x7f6cbebc4ae6 - std::sys_common::backtrace::__rust_end_short_backtrace::h4243b36539a052a4
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f6cbebc7292 - rust_begin_unwind
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/panicking.rs:645:5
  17:     0x7f6cbec13d05 - core::panicking::panic_fmt::h0396d052df2d310c
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/core/src/panicking.rs:72:14
  18:     0x7f6cbec13ab3 - core::panicking::panic_display::h5c3aa0fffe5c1bb1
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/core/src/panicking.rs:178:5
  19:     0x7f6cbec13ab3 - core::panicking::panic_str::h9aa8a76502539bda
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/core/src/panicking.rs:152:5
  20:     0x7f6cbec13ab3 - core::option::expect_failed::h3b7f6a03d7af5d21
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/core/src/option.rs:1985:5
  21:     0x7f6cbe135afe - rustc_middle[29cace5c4948c514]::ty::closure::closure_typeinfo.cold.0
  22:     0x7f6cbd5ec118 - rustc_query_impl[94d6f6b2e1186b94]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94d6f6b2e1186b94]::query_impl::closure_typeinfo::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 64usize]>>
  23:     0x7f6cbd5ec0f3 - <rustc_query_impl[94d6f6b2e1186b94]::query_impl::closure_typeinfo::dynamic_query::{closure#2} as core[578f67fda67372d9]::ops::function::FnOnce<(rustc_middle[29cace5c4948c514]::ty::context::TyCtxt, rustc_span[dd40b738055021c1]::def_id::LocalDefId)>>::call_once
  24:     0x7f6cbd5eb6aa - rustc_query_system[303543fe729c1791]::query::plumbing::try_execute_query::<rustc_query_impl[94d6f6b2e1186b94]::DynamicConfig<rustc_query_system[303543fe729c1791]::query::caches::VecCache<rustc_span[dd40b738055021c1]::def_id::LocalDefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 64usize]>>, false, false, false>, rustc_query_impl[94d6f6b2e1186b94]::plumbing::QueryCtxt, false>
  25:     0x7f6cbd5eb3f1 - rustc_query_impl[94d6f6b2e1186b94]::query_impl::closure_typeinfo::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7f6cbd5eabbe - <rustc_middle[29cace5c4948c514]::ty::context::TyCtxt>::closure_captures
  27:     0x7f6cbda01438 - rustc_borrowck[45e3ca37d614772c]::do_mir_borrowck
  28:     0x7f6cbda002ca - rustc_borrowck[45e3ca37d614772c]::mir_borrowck
  29:     0x7f6cbd9ffd6f - rustc_query_impl[94d6f6b2e1186b94]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94d6f6b2e1186b94]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7f6cbcceb483 - rustc_query_system[303543fe729c1791]::query::plumbing::try_execute_query::<rustc_query_impl[94d6f6b2e1186b94]::DynamicConfig<rustc_query_system[303543fe729c1791]::query::caches::VecCache<rustc_span[dd40b738055021c1]::def_id::LocalDefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[94d6f6b2e1186b94]::plumbing::QueryCtxt, false>
  31:     0x7f6cbcceb050 - rustc_query_impl[94d6f6b2e1186b94]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f6cbdc154f1 - <rustc_hir_analysis[9e914fc505a4e762]::collect::type_of::opaque::RpitConstraintChecker>::check
  33:     0x7f6cbb1780d5 - <rustc_hir_analysis[9e914fc505a4e762]::collect::type_of::opaque::RpitConstraintChecker as rustc_hir[5a61b80be043b6a0]::intravisit::Visitor>::visit_expr
  34:     0x7f6cbd96c770 - rustc_hir_analysis[9e914fc505a4e762]::collect::type_of::type_of_opaque
  35:     0x7f6cbd96be9b - rustc_query_impl[94d6f6b2e1186b94]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94d6f6b2e1186b94]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>
  36:     0x7f6cbcc53354 - rustc_query_system[303543fe729c1791]::query::plumbing::try_execute_query::<rustc_query_impl[94d6f6b2e1186b94]::DynamicConfig<rustc_query_system[303543fe729c1791]::query::caches::DefaultCache<rustc_span[dd40b738055021c1]::def_id::DefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[94d6f6b2e1186b94]::plumbing::QueryCtxt, false>
  37:     0x7f6cbdc587de - rustc_query_impl[94d6f6b2e1186b94]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f6cbccc0a38 - rustc_middle[29cace5c4948c514]::query::plumbing::query_get_at::<rustc_query_system[303543fe729c1791]::query::caches::DefaultCache<rustc_span[dd40b738055021c1]::def_id::DefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>>
  39:     0x7f6cbadd293f - rustc_hir_analysis[9e914fc505a4e762]::collect::type_of::type_of
  40:     0x7f6cbcc544b6 - rustc_query_impl[94d6f6b2e1186b94]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94d6f6b2e1186b94]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>
  41:     0x7f6cbcc53354 - rustc_query_system[303543fe729c1791]::query::plumbing::try_execute_query::<rustc_query_impl[94d6f6b2e1186b94]::DynamicConfig<rustc_query_system[303543fe729c1791]::query::caches::DefaultCache<rustc_span[dd40b738055021c1]::def_id::DefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[94d6f6b2e1186b94]::plumbing::QueryCtxt, false>
  42:     0x7f6cbcc52f1b - rustc_query_impl[94d6f6b2e1186b94]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7f6cbccc0a38 - rustc_middle[29cace5c4948c514]::query::plumbing::query_get_at::<rustc_query_system[303543fe729c1791]::query::caches::DefaultCache<rustc_span[dd40b738055021c1]::def_id::DefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 8usize]>>>
  44:     0x7f6cbd33164c - rustc_hir_analysis[9e914fc505a4e762]::check::check::check_mod_item_types
  45:     0x7f6cbd330053 - rustc_query_impl[94d6f6b2e1186b94]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94d6f6b2e1186b94]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 0usize]>>
  46:     0x7f6cbd5d4bbb - rustc_query_system[303543fe729c1791]::query::plumbing::try_execute_query::<rustc_query_impl[94d6f6b2e1186b94]::DynamicConfig<rustc_query_system[303543fe729c1791]::query::caches::DefaultCache<rustc_span[dd40b738055021c1]::def_id::LocalModDefId, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[94d6f6b2e1186b94]::plumbing::QueryCtxt, false>
  47:     0x7f6cbd5d4597 - rustc_query_impl[94d6f6b2e1186b94]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7f6cbd1b00d5 - rustc_hir_analysis[9e914fc505a4e762]::check_crate
  49:     0x7f6cbcf79957 - rustc_interface[91b7e6a880170ab5]::passes::analysis
  50:     0x7f6cbcf795b7 - rustc_query_impl[94d6f6b2e1186b94]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94d6f6b2e1186b94]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f6cbdb96be4 - rustc_query_system[303543fe729c1791]::query::plumbing::try_execute_query::<rustc_query_impl[94d6f6b2e1186b94]::DynamicConfig<rustc_query_system[303543fe729c1791]::query::caches::SingleCache<rustc_middle[29cace5c4948c514]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[94d6f6b2e1186b94]::plumbing::QueryCtxt, false>
  52:     0x7f6cbdb969d5 - rustc_query_impl[94d6f6b2e1186b94]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  53:     0x7f6cbdb9f5ff - rustc_interface[91b7e6a880170ab5]::interface::run_compiler::<core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>, rustc_driver_impl[5634551524408def]::run_compiler::{closure#1}>::{closure#0}
  54:     0x7f6cbdba691a - std[ebdb09ff591878d7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[91b7e6a880170ab5]::util::run_in_thread_with_globals<rustc_interface[91b7e6a880170ab5]::util::run_in_thread_pool_with_globals<rustc_interface[91b7e6a880170ab5]::interface::run_compiler<core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>, rustc_driver_impl[5634551524408def]::run_compiler::{closure#1}>::{closure#0}, core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>>::{closure#0}, core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>>
  55:     0x7f6cbdba6743 - <<std[ebdb09ff591878d7]::thread::Builder>::spawn_unchecked_<rustc_interface[91b7e6a880170ab5]::util::run_in_thread_with_globals<rustc_interface[91b7e6a880170ab5]::util::run_in_thread_pool_with_globals<rustc_interface[91b7e6a880170ab5]::interface::run_compiler<core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>, rustc_driver_impl[5634551524408def]::run_compiler::{closure#1}>::{closure#0}, core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>>::{closure#0}, core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[578f67fda67372d9]::result::Result<(), rustc_span[dd40b738055021c1]::ErrorGuaranteed>>::{closure#1} as core[578f67fda67372d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7f6cbebd1695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h37189f8e9fbe515c
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/alloc/src/boxed.rs:2007:9
  57:     0x7f6cbebd1695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hef966e35865ebb05
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/alloc/src/boxed.rs:2007:9
  58:     0x7f6cbebd1695 - std::sys::unix::thread::Thread::new::thread_start::h7d0959f9b7c2f0a7
                               at /rustc/1ab2bcda4303b81b1124b88ddff6f5e9a68d7bc2/library/std/src/sys/unix/thread.rs:108:17
  59:     0x7f6cb8aaa9eb - <unknown>
  60:     0x7f6cb8b2e7cc - <unknown>
  61:                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.76.0-nightly (1ab2bcda4 2023-11-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [closure_typeinfo] finding symbols for captures of closure `Foo::test::{closure#0}`
#1 [mir_borrowck] borrow-checking `Foo::test::{closure#0}`
#2 [type_of_opaque] computing type of opaque `Foo::test::{opaque#0}`
#3 [type_of] computing type of `Foo::test::{opaque#0}`
#4 [check_mod_item_types] checking item types in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0425, E0593, E0601.
For more information about an error, try `rustc --explain E0425`.

@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. C-bug Category: This is a bug. labels Nov 13, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 13, 2023
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-11-08
504f63e / #117418 ping @compiler-errors

@compiler-errors
Copy link
Member

I think @bvanjoi is fixing an issue that may have the same root cause.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 14, 2023
@bors bors closed this as completed in d14e52b Dec 17, 2023
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. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants