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

thread 'rustc' panicked at 'LocalTableInContext: key not found' #82438

Closed
marko1597 opened this issue Feb 23, 2021 · 4 comments · Fixed by #82442
Closed

thread 'rustc' panicked at 'LocalTableInContext: key not found' #82438

marko1597 opened this issue Feb 23, 2021 · 4 comments · Fixed by #82442
Assignees
Labels
A-borrow-checker Area: The borrow checker A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@marko1597
Copy link

Code

use std::error::Error;
struct A {
}

impl A {
    pub fn new() -> A {
        A {
        }
    }

    pub fn f<'a>(
        &'a self,
        team_name: &'a str,
        c: &'a mut dyn FnMut(String, String, u64, u64)
    ) -> Result<(), Box<dyn Error>> {
        Ok(())
    }
}


fn main() {
    let A = A::new();
    let participant_name = "A";

    let c = |a, b, c, d| {};

    A.f(participant_name, &mut c);
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (07194ffcd 2021-02-10)
binary: rustc
commit-hash: 07194ffcd25b0871ce560b9f702e52db27ac9f77
commit-date: 2021-02-10
host: x86_64-pc-windows-msvc
release: 1.52.0-nightly
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:515: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 (07194ffcd 2021-02-10) running on x86_64-pc-windows-msvc

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
Backtrace

thread 'rustc' panicked at 'LocalTableInContext: key not found', compiler\rustc_mir\src\borrow_check\diagnostics\mutability_errors.rs:515:30
stack backtrace:
   0:     0x7ffbe171896e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h160322fcc0f12a19
   1:     0x7ffbe17447bb - core::fmt::write::ha3ea633b18d2da75
   2:     0x7ffbe170bc48 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h0112a934cd010a1c
   3:     0x7ffbe171cb3d - std::panicking::take_hook::h7c389d310fc84231
   4:     0x7ffbe171c609 - std::panicking::take_hook::h7c389d310fc84231
   5:     0x7ffbae422757 - rustc_driver::report_ice::hd4f773c8d782ddcc
   6:     0x7ffbe171d5a2 - std::panicking::rust_panic_with_hook::h13af0da83034d6f3
   7:     0x7ffbe171d091 - rust_begin_unwind
   8:     0x7ffbe17192ff - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h160322fcc0f12a19
   9:     0x7ffbe171cfe9 - rust_begin_unwind
  10:     0x7ffbe1740a70 - core::panicking::panic_fmt::h45da916c710b88f7
  11:     0x7ffbe1740662 - core::option::expect_failed::h10e986651fedbefa
  12:     0x7ffbb1672998 - <rustc_mir::borrow_check::constraint_generation::ConstraintGeneration as rustc_middle::mir::visit::Visitor>::visit_terminator::hab4a7aed9adbb356
  13:     0x7ffbb166e855 - <rustc_mir::borrow_check::constraint_generation::ConstraintGeneration as rustc_middle::mir::visit::Visitor>::visit_terminator::hab4a7aed9adbb356
  14:     0x7ffbb1681ddc - <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::framework::visitor::ResultsVisitor>::visit_terminator_after_primary_effect::h9ae0111032217782
  15:     0x7ffbb1680488 - <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect::h5a67661933df941f
  16:     0x7ffbb1458e57 - <rustc_mir::borrow_check::renumber::NllVisitor as rustc_middle::mir::visit::MutVisitor>::visit_const::heacffb162ebd9411
  17:     0x7ffbb1222c0b - <rustc_mir::borrow_check::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_body::heae462dc9bbc1737
  18:     0x7ffbb167afbe - rustc_mir::borrow_check::provide::hcca461ae48ff4737
  19:     0x7ffbb139938b - <rustc_mir::transform::early_otherwise_branch::OptimizationInfo as core::fmt::Debug>::fmt::h3378c483dc2fcfde
  20:     0x7ffbb167721b - rustc_mir::borrow_check::provide::hcca461ae48ff4737
  21:     0x7ffbae5b4bae - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h055d5881bebd66a2
  22:     0x7ffbae5f6e16 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h055d5881bebd66a2
  23:     0x7ffbae572e00 - rustc_interface::util::commit_date_str::h2101977ea4670309
  24:     0x7ffbae5faa88 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h055d5881bebd66a2
  25:     0x7ffbae5c94cf - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h055d5881bebd66a2
  26:     0x7ffbae5b9a17 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h055d5881bebd66a2
  27:     0x7ffbae5c7409 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h055d5881bebd66a2
  28:     0x7ffbae6141cd - rustc_interface::passes::QueryContext::print_stats::hcf9482dcf489c697
  29:     0x7ffbae3cfd0b - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::ha43055df5546b109
  30:     0x7ffbae394466 - <rustc_lint::BuiltinCombinedModuleLateLintPass as rustc_lint::passes::LateLintPass>::check_impl_item_post::hc9cbccfc374f5770
  31:     0x7ffbae410c4d - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::ha43055df5546b109
  32:     0x7ffbae44be11 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h6e636cdd0f329a33
  33:     0x7ffbae3d4dff - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::ha43055df5546b109
  34:     0x7ffbae3d44cc - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::ha43055df5546b109
  35:     0x7ffbae42cafc - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h565c544a3fcd0386
  36:     0x7ffbae396ff2 - <rustc_mir::shim::DropShimElaborator as rustc_mir::util::elaborate_drops::DropElaborator>::deref_subpath::ha4d2e420fbea5398
  37:     0x7ffbae4257ac - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h565c544a3fcd0386
  38:     0x7ffbae3981f9 - <rustc_mir::shim::DropShimElaborator as rustc_mir::util::elaborate_drops::DropElaborator>::deref_subpath::ha4d2e420fbea5398
  39:     0x7ffbae442424 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h6e636cdd0f329a33
  40:     0x7ffbae44d1de - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h6e636cdd0f329a33
  41:     0x7ffbae3cc8cd - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::ha43055df5546b109
  42:     0x7ffbe172cb8a - std::sys::windows::thread::Thread::new::hd38a560d738a063d
  43:     0x7ffc1f227034 - BaseThreadInitThunk
  44:     0x7ffc211fd241 - RtlUserThreadStart

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 (07194ffcd 2021-02-10) running on x86_64-pc-windows-msvc

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`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: 6 warnings emitted

error: could not compile `bug_example`

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

@marko1597 marko1597 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 Feb 23, 2021
@jonas-schievink jonas-schievink added A-borrow-checker Area: The borrow checker A-diagnostics Area: Messages for errors, warnings, and lints I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 23, 2021
@LeSeulArtichaut
Copy link
Contributor

This regressed in 1.51 according to the playground

@LeSeulArtichaut LeSeulArtichaut added regression-from-stable-to-beta Performance or correctness regression from stable to beta. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Feb 23, 2021
@LeSeulArtichaut
Copy link
Contributor

searched nightlies: from nightly-2020-12-15 to nightly-2021-02-01
regressed nightly: nightly-2021-01-30
searched commits: from c0b64d9 to b122908
regressed commit: 74500b9

Regressed in #81493

@LeSeulArtichaut LeSeulArtichaut removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Feb 23, 2021
@LeSeulArtichaut
Copy link
Contributor

LeSeulArtichaut commented Feb 23, 2021

Most likely due to #81158, cc @1000teslas @Aaron1011

@Aaron1011 Aaron1011 self-assigned this Feb 23, 2021
@steveklabnik steveklabnik changed the title Compiler Crash thread 'rustc' panicked at 'LocalTableInContext: key not found' Feb 23, 2021
@camelid
Copy link
Member

camelid commented Feb 24, 2021

Assigning P-medium and removing I-prioritize as discussed in the prioritization working group.

@camelid camelid added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 24, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Feb 26, 2021
This is actually rust-lang/rust#82526, a minimized duplicate of 82438.

Issue: rust-lang/rust#82438
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Feb 27, 2021
…matthewjasper

Skip emitting closure diagnostic when closure_kind_origins has no entry

Fixes rust-lang#82438

This map is not guarnateed to have an entry for a closure.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Feb 27, 2021
…matthewjasper

Skip emitting closure diagnostic when closure_kind_origins has no entry

Fixes rust-lang#82438

This map is not guarnateed to have an entry for a closure.
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 27, 2021
@bors bors closed this as completed in 46db4ba Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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.

6 participants