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

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

Closed
klozovin opened this issue Aug 7, 2018 · 7 comments
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@klozovin
Copy link

klozovin commented Aug 7, 2018

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.

@estebank estebank added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Aug 8, 2018
@estebank
Copy link
Contributor

estebank commented Aug 8, 2018

Happens on stable 1.28. Doesn't occur on beta, nightly or 1.27.2.

@estebank estebank added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Aug 8, 2018
@Mark-Simulacrum Mark-Simulacrum self-assigned this Aug 9, 2018
@nikomatsakis
Copy link
Contributor

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
Copy link
Member

I'll bisect this.

@nikomatsakis nikomatsakis added P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 9, 2018
@Mark-Simulacrum
Copy link
Member

Documenting my process for finding the start/end commits:

rustc +1.27.0 -V: 3eda71b
rustc +1.28.0 -V: 9634041

These 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: 09a0bc7
This 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 862703e05e275d77b0b594bb5d1a26a6340933f2

862703e is #51414, cc @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Aug 10, 2018

This was fixed in #51773

@oli-obk oli-obk closed this as completed Aug 10, 2018
@estebank
Copy link
Contributor

Shouldn't it be backported to stable?

@Mark-Simulacrum
Copy link
Member

Since the code is invalid anyway I don't think there's a reason to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants