Skip to content

Internal compiler error: unexpected panic: thread 'main' panicked at 'no entry found for key' #53146

Closed
@klozovin

Description

@klozovin

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.

Metadata

Metadata

Labels

I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant 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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions