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 on 1.51.0 stable: 'LocalTableInContext: key not found' #84044

Closed
trtsl opened this issue Apr 9, 2021 · 3 comments · Fixed by #92312
Closed

ICE on 1.51.0 stable: 'LocalTableInContext: key not found' #84044

trtsl opened this issue Apr 9, 2021 · 3 comments · Fixed by #92312
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. 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

@trtsl
Copy link

trtsl commented Apr 9, 2021

I get the following ICE with rustc 1.51.0 stable (but not on nightly). The ICE can currently be reproduced on the playground.

Code

fn foo<F>(_: &mut F)
where
    F: FnMut(),
{
}

fn main() {
    let f = || {};
    foo(&mut f);
}

Meta

rustc --version --verbose:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

Error output

thread 'rustc' panicked at 'LocalTableInContext: key not found', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:512:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.51.0 (2fd73fabe 2021-03-23) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
Backtrace

stack backtrace:
   0:     0x7f1bf31efee0 - std::backtrace_rs::backtrace::libunwind::trace::h5e9d00f0cdf4f57e
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f1bf31efee0 - std::backtrace_rs::backtrace::trace_unsynchronized::hd5302bd66215dab9
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1bf31efee0 - std::sys_common::backtrace::_print_fmt::ha0237cd11a34e2bf
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f1bf31efee0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h171d4c10df1a98ee
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f1bf3260d0c - core::fmt::write::h89e4288724daa3fa
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/fmt/mod.rs:1096:17
   5:     0x7f1bf31e2ff2 - std::io::Write::write_fmt::h6d40f996e84584d9
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/io/mod.rs:1568:15
   6:     0x7f1bf31f3d95 - std::sys_common::backtrace::_print::h0c0b93221682afc8
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f1bf31f3d95 - std::sys_common::backtrace::print::h57a9f95204c2fdd6
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f1bf31f3d95 - std::panicking::default_hook::{{closure}}::h4245258b50e37e69
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:208:50
   9:     0x7f1bf31f38f3 - std::panicking::default_hook::h7b00dcc1d0944747
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:225:9
  10:     0x7f1bf3a55f3b - rustc_driver::report_ice::hd11b2540f4ebea82
  11:     0x7f1bf31f4696 - std::panicking::rust_panic_with_hook::h71e6a073d87de1f5
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:595:17
  12:     0x7f1bf31f41b7 - std::panicking::begin_panic_handler::{{closure}}::hd549436f6bb6dbb8
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:497:13
  13:     0x7f1bf31f037c - std::sys_common::backtrace::__rust_end_short_backtrace::h4e5f4b72b04174c3
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f1bf31f4119 - rust_begin_unwind
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:493:5
  15:     0x7f1bf325d331 - core::panicking::panic_fmt::hcd56f7f635f62c74
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/panicking.rs:92:14
  16:     0x7f1bf325cf13 - core::option::expect_failed::h5086d7196b9e2f90
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/option.rs:1292:5
  17:     0x7f1bf43387a5 - <rustc_middle::ty::context::LocalTableInContext<V> as core::ops::index::Index<rustc_hir::hir_id::HirId>>::index::h4262f7222f53d9a3
  18:     0x7f1bf63f8051 - rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::show_mutating_upvar::he1ade011ace89f83
  19:     0x7f1bf45859c8 - rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::report_mutability_error::h92f4889bc2ffbad0
  20:     0x7f1bf58c273d - rustc_mir::borrow_check::MirBorrowckCtxt::access_place::he413ef1491846359
  21:     0x7f1bf58bf5d5 - <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect::h4a3b563d392aba85
  22:     0x7f1bf57edc6a - <rustc_mir::dataflow::framework::direction::Forward as rustc_mir::dataflow::framework::direction::Direction>::visit_results_in_block::h870f31eb04697a47
  23:     0x7f1bf5915657 - rustc_mir::dataflow::framework::visitor::visit_results::h794a2b56f9d3d4b0
  24:     0x7f1bf58baa18 - rustc_mir::borrow_check::do_mir_borrowck::hb60feaaeb8a607de
  25:     0x7f1bf5745b13 - rustc_infer::infer::InferCtxtBuilder::enter::h07df4d63d7a026b7
  26:     0x7f1bf58b9827 - rustc_mir::borrow_check::mir_borrowck::haaef7dc43c079d9a
  27:     0x7f1bf58a10a2 - core::ops::function::FnOnce::call_once::hc38b8e47b62f683b
  28:     0x7f1bf5365a1c - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute::hb0d3cc841aa322f9
  29:     0x7f1bf53499b3 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h886d6b4785beb653
  30:     0x7f1bf5365b91 - rustc_data_structures::stack::ensure_sufficient_stack::h01f182f0e03bf1fe
  31:     0x7f1bf536c047 - rustc_query_system::query::plumbing::force_query_with_job::h119090dded347495
  32:     0x7f1bf5369bf4 - rustc_query_system::query::plumbing::get_query_impl::hbfe84cb345062bf1
  33:     0x7f1bf536bd17 - rustc_query_system::query::plumbing::ensure_query_impl::he89b48791c7be466
  34:     0x7f1bf5354029 - rustc_session::utils::<impl rustc_session::session::Session>::time::hf5b62f8849e1a4bb
  35:     0x7f1bf5df560d - rustc_interface::passes::analysis::he9c47257344f5833
  36:     0x7f1bf5d93e49 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h501487ec9601b279
  37:     0x7f1bf5d7adae - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h04e04705fa61d63f
  38:     0x7f1bf5d9b131 - rustc_data_structures::stack::ensure_sufficient_stack::h913d0f9cea417575
  39:     0x7f1bf5d796a6 - rustc_query_system::query::plumbing::force_query_with_job::he07d852ee2123104
  40:     0x7f1bf5d78ae7 - rustc_query_system::query::plumbing::get_query_impl::he751dbcd564e84a6
  41:     0x7f1bf5d9401a - rustc_interface::passes::QueryContext::enter::h339a136ee015bb08
  42:     0x7f1bf5d99d40 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hc8c0f3e9bba77540
  43:     0x7f1bf5d93643 - rustc_span::with_source_map::hedfeccc0422f91c4
  44:     0x7f1bf5d9aeca - rustc_interface::interface::create_compiler_and_run::h7abf0b53119fd7ea
  45:     0x7f1bf5d93d05 - rustc_span::with_session_globals::hb5dbfdbd3bd12723
  46:     0x7f1bf5d9b36a - std::sys_common::backtrace::__rust_begin_short_backtrace::hfe0fde7e082e2baf
  47:     0x7f1bf5db7c4a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h83306388c44d16bf
  48:     0x7f1bf3204c8a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h61144a2be4ee36d8
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/alloc/src/boxed.rs:1521:9
  49:     0x7f1bf3204c8a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcf5d395fdd120c17
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/alloc/src/boxed.rs:1521:9
  50:     0x7f1bf3204c8a - std::sys::unix::thread::Thread::new::thread_start::hb5e40d3d934ebb7a
                               at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys/unix/thread.rs:71:17
  51:     0x7f1bf3123299 - start_thread
  52:     0x7f1bf30373b3 - clone
  53:                0x0 - <unknown>

@trtsl trtsl added 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. labels Apr 9, 2021
@trtsl
Copy link
Author

trtsl commented Apr 9, 2021

Even simpler: playground.

fn main() {
    let f = || {};
    drop(&mut f);
}

@fanninpm
Copy link

This ICE also does not happen in the 1.52 beta.

fanninpm added a commit to fanninpm/glacier that referenced this issue Apr 16, 2021
@matthiaskrgr
Copy link
Member

Does not seem to ICE rustc 1.57.0-nightly (497ee321a 2021-09-09)

@rustbot modify labels: E-needs-test

@rustbot rustbot added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Sep 10, 2021
BGR360 added a commit to BGR360/rust that referenced this issue Dec 27, 2021
The ICE from rust-lang#84044 no longer occurs.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 5, 2022
Mark-Simulacrum pushed a commit to BGR360/rust that referenced this issue Jan 28, 2022
The ICE from rust-lang#84044 no longer occurs.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 29, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 29, 2022
@bors bors closed this as completed in d08e816 Jan 29, 2022
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. 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