Repository navigation
Internal compiler error: unexpected panic: thread 'main' panicked at 'no entry found for key' #53146
Copy link
Copy link
Closed
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
This is the code that triggers an ICE:
pub struct Foo;
pub trait Bar {}
fn mk() -> Vec<Foo<impl Bar>> { }
This is the output:
Checking foo v0.1.0 (file:///home/ ...)
error[E0244]: wrong number of type arguments: expected 0, found 1
--> lib/lib.rs:6:16
|
6 | fn mk() -> Vec<Foo<impl Bar>> { }
| ^^^^^^^^^^^^^ expected no type arguments
error[E0308]: mismatched types
--> lib/lib.rs:6:31
|
6 | fn mk() -> Vec<Foo<impl Bar>> { }
| ^^^ expected struct `std::vec::Vec`, found ()
|
= note: expected type `std::vec::Vec<Foo>`
found type `()`
thread 'main' panicked at 'no entry found for key', libcore/option.rs:960:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to 2 previous errors
Some errors occurred: E0244, E0308.
For more information about an error, try `rustc --explain E0244`.
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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.28.0 (9634041f0 2018-07-30) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
And here is the backtrace:
thread 'main' panicked at 'no entry found for key', libcore/option.rs:960:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:515
6: std::panicking::continue_panic_fmt
at libstd/panicking.rs:426
7: rust_begin_unwind
at libstd/panicking.rs:337
8: core::panicking::panic_fmt
at libcore/panicking.rs:92
9: core::option::expect_failed
at libcore/option.rs:960
10: rustc_typeck::collect::type_of
11: rustc::ty::query::__query_compute::type_of
12: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::type_of<'tcx>>::compute
13: rustc::ty::context::tls::with_context
14: rustc::dep_graph::graph::DepGraph::with_task_impl
15: rustc::ty::context::tls::with_related_context
16: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
17: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
18: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::type_of
19: <rustc_typeck::collect::CollectItemTypesVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
20: rustc::hir::Crate::visit_all_item_likes
21: rustc::session::Session::track_errors
22: rustc_typeck::check_crate
23: rustc::ty::context::tls::enter_context
24: <std::thread::local::LocalKey<T>>::with
25: rustc::ty::context::TyCtxt::create_and_enter
26: rustc_driver::driver::compile_input
27: rustc_driver::run_compiler_with_pool
28: <scoped_tls::ScopedKey<T>>::set
29: syntax::with_globals
30: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
31: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
32: rustc_driver::run
33: rustc_driver::main
34: std::rt::lang_start::{{closure}}
35: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
36: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
37: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libstd/rt.rs:58
38: main
39: __libc_start_main
40: <unknown>
query stack during panic:
#0 [type_of] processing `mk::{{exist-impl-Trait}}`
end of query stack
error: aborting due to 2 previous errors
Using rustc 1.30.0-nightly (73c78734b 2018-08-05) there's no ICE, just a regular type error. Switching the type signature from -> Vec<Foo<impl Bar>> to -> Vec<Foo<dyn Bar>> also doesn't produce an ICE, just a type error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Activity
estebank commentedon Aug 8, 2018
Happens on stable 1.28. Doesn't occur on beta, nightly or 1.27.2.
nikomatsakis commentedon Aug 9, 2018
Visiting in compiler team meeting.
Can we bisect this to find where it is fixed?
It seems unlikely that we are going to issue a point release, though.
Mark-Simulacrum commentedon Aug 9, 2018
I'll bisect this.
Mark-Simulacrum commentedon Aug 9, 2018
Documenting my process for finding the start/end commits:
rustc +1.27.0 -V: 3eda71brustc +1.28.0 -V: 9634041These are commits on the stable branches though so we can't use them directly
git merge-base master 3eda71b00: 715d6a9 (this is the "end" of the range as the older commit)git merge-base master 9634041f0: 09a0bc7This commit is somehow not a bors commit, so git log it and search for the closest bors commit, which is 7d313ea.
Now, run bisect:
./target/release/cargo-bisect-rustc --test-dir case/foo --prompt --by-commit --end 7d313eaeb6589c6236719a3130337676b550bada --start 715d6a98aa4908dfb85b55f97e51af330d0baf7f searched toolchains 715d6a98aa4908dfb85b55f97e51af330d0baf7f through 7d313eaeb6589c6236719a3130337676b550bada regression in 862703e05e275d77b0b594bb5d1a26a6340933f2862703e is #51414, cc @oli-obk
oli-obk commentedon Aug 10, 2018
This was fixed in #51773
estebank commentedon Aug 10, 2018
Shouldn't it be backported to stable?
Mark-Simulacrum commentedon Aug 10, 2018
Since the code is invalid anyway I don't think there's a reason to do so.