Skip to content

'rustc' panicked at 'LocalTableInContext: key not found' #82526

Closed
@evan-brass

Description

@evan-brass

Code

fn main() {
    let inner;
    let outer = || {
        inner = || {};
        inner();
    };
    outer();
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (a15f484b9 2021-02-22)
binary: rustc
commit-hash: a15f484b918a4533ad633ea903ccce82910af342
commit-date: 2021-02-22
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

Doesn't panic in Stable.

Error output

thread 'rustc' panicked at 'LocalTableInContext: key not found', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:516: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.52.0-nightly (a15f484b9 2021-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `main::{closure#0}`
#1 [mir_borrowck] borrow-checking `main`
end of query stack
error: could not compile `rs-min`

To learn more, run the command again with --verbose.
Backtrace

   Compiling rs-min v0.1.0 (/home/evan/Code/Repos/rs-min)
thread 'rustc' panicked at 'LocalTableInContext: key not found', compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:516:30
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a15f484b918a4533ad633ea903ccce82910af342/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/a15f484b918a4533ad633ea903ccce82910af342/library/core/src/panicking.rs:92:14
   2: core::option::expect_failed
             at /rustc/a15f484b918a4533ad633ea903ccce82910af342/library/core/src/option.rs:1292:5
   3: <rustc_middle::ty::context::LocalTableInContext<V> as core::ops::index::Index<rustc_hir::hir_id::HirId>>::index
   4: rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::show_mutating_upvar
   5: rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::report_mutability_error
   6: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
   7: rustc_mir::borrow_check::MirBorrowckCtxt::mutate_place
   8: <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
   9: <rustc_mir::dataflow::framework::direction::Forward as rustc_mir::dataflow::framework::direction::Direction>::visit_results_in_block
  10: rustc_mir::dataflow::framework::visitor::visit_results
  11: rustc_mir::borrow_check::do_mir_borrowck
  12: rustc_infer::infer::InferCtxtBuilder::enter
  13: rustc_mir::borrow_check::mir_borrowck
  14: core::ops::function::FnOnce::call_once
  15: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::force_query_with_job
  19: rustc_query_system::query::plumbing::get_query_impl
  20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  21: rustc_mir::borrow_check::type_check::TypeChecker::check_rvalue
  22: rustc_mir::borrow_check::type_check::TypeChecker::typeck_mir
  23: rustc_mir::borrow_check::type_check::type_check
  24: rustc_mir::borrow_check::nll::compute_regions
  25: rustc_mir::borrow_check::do_mir_borrowck
  26: rustc_infer::infer::InferCtxtBuilder::enter
  27: rustc_mir::borrow_check::mir_borrowck
  28: core::ops::function::FnOnce::call_once
  29: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::force_query_with_job
  33: rustc_query_system::query::plumbing::get_query_impl
  34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  35: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  36: rustc_interface::passes::analysis
  37: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  39: rustc_data_structures::stack::ensure_sufficient_stack
  40: rustc_query_system::query::plumbing::force_query_with_job
  41: rustc_query_system::query::plumbing::get_query_impl
  42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  43: rustc_interface::passes::QueryContext::enter
  44: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  45: rustc_span::with_source_map
  46: rustc_interface::interface::create_compiler_and_run
  47: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.52.0-nightly (a15f484b9 2021-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `main::{closure#0}`
#1 [mir_borrowck] borrow-checking `main`
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `rs-min`

To learn more, run the command again with --verbose.

Maybe duplicate of #82438?

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions