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 non_lifetime_binders with late-bound const parameter in constant #120860

Closed
matthiaskrgr opened this issue Feb 9, 2024 · 4 comments · Fixed by #120847
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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):

#![feature(non_lifetime_binders)]

fn walk2<'a, T: 'a>(_: T)
where
    for<const C: usize> [(); C]: 'a,
{
}

original:

#![feature(non_lifetime_binders)]

fn walk2<'a, T: 'a>(_: T)
where
    for<const C: usize> [(); C]: 'a, // replacing C by 1 fixes ice
{}

fn main() {}

Version information

rustc 1.78.0-nightly (f4cfd8720 2024-02-09)
binary: rustc
commit-hash: f4cfd872028398da2b2d85c368c51f4d007dc6af
commit-date: 2024-02-09
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

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

Program output

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.V9RATaOuuJaC/rustc_testrunner_tmpdir_reporting.CtMPsSqyI46C/mvce.rs:1:12
  |
1 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default

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

error: cannot capture late-bound const parameter in constant
 --> /tmp/icemaker_global_tempdir.V9RATaOuuJaC/rustc_testrunner_tmpdir_reporting.CtMPsSqyI46C/mvce.rs:5:30
  |
5 |     for<const C: usize> [(); C]: 'a,
  |         --------------       ^
  |         |
  |         parameter defined here

thread 'rustc' panicked at compiler/rustc_mir_build/src/thir/cx/expr.rs:887:59:
no entry found for key
stack backtrace:
   0:     0x7f90f23e1946 - std::backtrace_rs::backtrace::libunwind::trace::hb28756ba02a3d69b
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f90f23e1946 - std::backtrace_rs::backtrace::trace_unsynchronized::h4059a8c1298faac5
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f90f23e1946 - std::sys_common::backtrace::_print_fmt::hd497b104503e03df
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f90f23e1946 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc452c05edd0934f1
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f90f2434390 - core::fmt::rt::Argument::fmt::h9d45194fabe22b74
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/core/src/fmt/rt.rs:142:9
   5:     0x7f90f2434390 - core::fmt::write::h2b690ea9afc76b6a
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f90f23d50ff - std::io::Write::write_fmt::h1113da361aa3c239
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/io/mod.rs:1854:15
   7:     0x7f90f23e1724 - std::sys_common::backtrace::_print::h8571c116cfdaf0e3
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f90f23e1724 - std::sys_common::backtrace::print::h15612d1cb18f5748
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f90f23e44e7 - std::panicking::default_hook::{{closure}}::h6ec650d8e0f53942
  10:     0x7f90f23e4249 - std::panicking::default_hook::h6789db044ec621ae
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/panicking.rs:292:9
  11:     0x7f90ef125e6c - std[2db7d671f3a9f29e]::panicking::update_hook::<alloc[8a21bb79ecee740c]::boxed::Box<rustc_driver_impl[dad15490f0d3dd55]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f90f23e4c36 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h50a1085617a0c032
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/alloc/src/boxed.rs:2029:9
  13:     0x7f90f23e4c36 - std::panicking::rust_panic_with_hook::hc9844a49c9f95922
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/panicking.rs:785:13
  14:     0x7f90f23e4982 - std::panicking::begin_panic_handler::{{closure}}::h8dedac3fc8ea08c9
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/panicking.rs:659:13
  15:     0x7f90f23e1e46 - std::sys_common::backtrace::__rust_end_short_backtrace::h4a51b280e6e2cc4e
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f90f23e46d4 - rust_begin_unwind
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/panicking.rs:647:5
  17:     0x7f90f2430a95 - core::panicking::panic_fmt::hcd0ca5c421be097d
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/core/src/panicking.rs:72:14
  18:     0x7f90f2430843 - core::panicking::panic_display::h3cdbc3fe443e829c
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/core/src/panicking.rs:196:5
  19:     0x7f90f2430843 - core::panicking::panic_str::h85c6aabed1330d1c
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/core/src/panicking.rs:171:5
  20:     0x7f90f2430843 - core::option::expect_failed::h1778fccd1b5de473
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/core/src/option.rs:1987:5
  21:     0x7f90f08b449c - <rustc_mir_build[55ee9063a4de6d06]::thir::cx::Cx>::mirror_expr
  22:     0x7f90f07d9509 - rustc_mir_build[55ee9063a4de6d06]::thir::cx::thir_body
  23:     0x7f90f07d8ed4 - rustc_query_impl[38298c29941606b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[38298c29941606b]::query_impl::thir_body::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4117828168ce66f2]::query::erase::Erased<[u8; 16usize]>>
  24:     0x7f90f0a35786 - rustc_query_system[596b756f2478c92c]::query::plumbing::try_execute_query::<rustc_query_impl[38298c29941606b]::DynamicConfig<rustc_query_system[596b756f2478c92c]::query::caches::VecCache<rustc_span[13fbbf930593c3af]::def_id::LocalDefId, rustc_middle[4117828168ce66f2]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[38298c29941606b]::plumbing::QueryCtxt, false>
  25:     0x7f90f0a353d5 - rustc_query_impl[38298c29941606b]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7f90f082de65 - rustc_mir_build[55ee9063a4de6d06]::check_unsafety::check_unsafety
  27:     0x7f90f082dd49 - rustc_query_impl[38298c29941606b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[38298c29941606b]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4117828168ce66f2]::query::erase::Erased<[u8; 0usize]>>
  28:     0x7f90f0c8b64e - rustc_query_system[596b756f2478c92c]::query::plumbing::try_execute_query::<rustc_query_impl[38298c29941606b]::DynamicConfig<rustc_query_system[596b756f2478c92c]::query::caches::VecCache<rustc_span[13fbbf930593c3af]::def_id::LocalDefId, rustc_middle[4117828168ce66f2]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[38298c29941606b]::plumbing::QueryCtxt, false>
  29:     0x7f90f0c8b317 - rustc_query_impl[38298c29941606b]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f90f0e7fcc6 - rustc_interface[efaa592dac13667a]::passes::analysis
  31:     0x7f90f0e7f71f - rustc_query_impl[38298c29941606b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[38298c29941606b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4117828168ce66f2]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7f90f1127d72 - rustc_query_system[596b756f2478c92c]::query::plumbing::try_execute_query::<rustc_query_impl[38298c29941606b]::DynamicConfig<rustc_query_system[596b756f2478c92c]::query::caches::SingleCache<rustc_middle[4117828168ce66f2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[38298c29941606b]::plumbing::QueryCtxt, false>
  33:     0x7f90f1127ad5 - rustc_query_impl[38298c29941606b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f90f1136b42 - rustc_interface[efaa592dac13667a]::interface::run_compiler::<core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>, rustc_driver_impl[dad15490f0d3dd55]::run_compiler::{closure#0}>::{closure#0}
  35:     0x7f90f139ee08 - std[2db7d671f3a9f29e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[efaa592dac13667a]::util::run_in_thread_with_globals<rustc_interface[efaa592dac13667a]::util::run_in_thread_pool_with_globals<rustc_interface[efaa592dac13667a]::interface::run_compiler<core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>, rustc_driver_impl[dad15490f0d3dd55]::run_compiler::{closure#0}>::{closure#0}, core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>>::{closure#0}, core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>>
  36:     0x7f90f139ec37 - <<std[2db7d671f3a9f29e]::thread::Builder>::spawn_unchecked_<rustc_interface[efaa592dac13667a]::util::run_in_thread_with_globals<rustc_interface[efaa592dac13667a]::util::run_in_thread_pool_with_globals<rustc_interface[efaa592dac13667a]::interface::run_compiler<core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>, rustc_driver_impl[dad15490f0d3dd55]::run_compiler::{closure#0}>::{closure#0}, core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>>::{closure#0}, core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cacc4eb881020547]::result::Result<(), rustc_span[13fbbf930593c3af]::ErrorGuaranteed>>::{closure#1} as core[cacc4eb881020547]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f90f23ee2d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h507eeaa619802b96
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/alloc/src/boxed.rs:2015:9
  38:     0x7f90f23ee2d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6587eb2d6c93a7aa
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/alloc/src/boxed.rs:2015:9
  39:     0x7f90f23ee2d5 - std::sys::pal::unix::thread::Thread::new::thread_start::h52c520a06bfbe43e
                               at /rustc/f4cfd872028398da2b2d85c368c51f4d007dc6af/library/std/src/sys/pal/unix/thread.rs:108:17
  40:     0x7f90ec2aa9eb - <unknown>
  41:     0x7f90ec32e7cc - <unknown>
  42:                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.78.0-nightly (f4cfd8720 2024-02-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [thir_body] building THIR for `walk2::{constant#0}`
#1 [check_unsafety] unsafety-checking `walk2::{constant#0}`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0601`.

@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. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` labels Feb 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 9, 2024
@matthiaskrgr matthiaskrgr changed the title ice: no entry found for key none lifetime binders with late-bound const parameter in constant ice: no entry found for key non_lifetime_binders with late-bound const parameter in constant Feb 9, 2024
@matthiaskrgr
Copy link
Member Author

Another one of #120550 it seems cc @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Feb 9, 2024

Huh didn't I just fix that?

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Feb 9, 2024

Might be another "layer" of crashes below #120779 and #120816 ?

edit: or is there a pending pr?

@oli-obk
Copy link
Contributor

oli-obk commented Feb 10, 2024

Yea it's #120847

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 10, 2024
oli-obk added a commit to oli-obk/rust that referenced this issue Feb 13, 2024
…errors

Continue compilation after check_mod_type_wf errors

The ICEs fixed here were probably reachable through const eval gymnastics before, but now they are easily reachable without that, too.

The new errors are often bugfixes, where useful errors were missing, because they were reported after the early abort. In other cases sometimes they are just duplication of already emitted errors, which won't be user-visible due to deduplication.

fixes rust-lang#120860
oli-obk added a commit to oli-obk/rust that referenced this issue Feb 13, 2024
…errors

Continue compilation after check_mod_type_wf errors

The ICEs fixed here were probably reachable through const eval gymnastics before, but now they are easily reachable without that, too.

The new errors are often bugfixes, where useful errors were missing, because they were reported after the early abort. In other cases sometimes they are just duplication of already emitted errors, which won't be user-visible due to deduplication.

fixes rust-lang#120860
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 13, 2024
…rors

Continue compilation after check_mod_type_wf errors

The ICEs fixed here were probably reachable through const eval gymnastics before, but now they are easily reachable without that, too.

The new errors are often bugfixes, where useful errors were missing, because they were reported after the early abort. In other cases sometimes they are just duplication of already emitted errors, which won't be user-visible due to deduplication.

fixes rust-lang#120860
@bors bors closed this as completed in ee9c7c9 Feb 14, 2024
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. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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