Skip to content

Failed to recover key for type_of with hash #79890

Closed
@hellow554

Description

@hellow554

This seems to be an incremental error‽
We need an external crate for this to work. Haven't managed it to work in an internal mod only :/
Also this only happens with cargo test. Haven't managed to get it running with cargo check sadly

Code

extern crate (let's call it f)

pub trait F {}

code

use f::F

Then just remove and add f::F afterwards again (or the other way round, it doesn't matter).

This script does it for you:

#! /bin/bash

cargo clean

echo '' > src/main.rs
cargo test
echo 'use f::F;' > src/main.rs
cargo test
echo '' > src/main.rs
cargo test

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (f0f68778f 2020-12-09)
binary: rustc
commit-hash: f0f68778f798d6d34649745b41770829b17ba5b8
commit-date: 2020-12-09
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly
Backtrace

thread 'rustc' panicked at 'Failed to recover key for type_of(3739ed735b1bc82c-29bc8a543e26e1e2) with hash 3739ed735b1bc82c-29bc8a543e26e1e2', compiler/rustc_middle/src/ty/query/mod.rs:235:5
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.50.0-nightly (f0f68778f 2020-12-09) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
end of query stack
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `LLVMing`,
 right: `Codegenning`', /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/compiler/rustc_codegen_ssa/src/back/write.rs:1425:21

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.50.0-nightly (f0f68778f 2020-12-09) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
end of query stack
error: could not compile `day10`

and with RUST_BACKTRACE=full the LLVMing assert vanishes

thread 'rustc' panicked at 'Failed to recover key for type_of(3739ed735b1bc82c-29bc8a543e26e1e2) with hash 3739ed735b1bc82c-29bc8a543e26e1e2', compiler/rustc_middle/src/ty/query/mod.rs:235:5
stack backtrace:
   0:     0x7f20c54546b7 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f20c54546b7 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f20c54546b7 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f20c54546b7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f20c54c852c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f20c54466a2 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/io/mod.rs:1519:15
   6:     0x7f20c54583b5 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f20c54583b5 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f20c54583b5 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/panicking.rs:208:50
   9:     0x7f20c5457f0a - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/panicking.rs:225:9
  10:     0x7f20c5d103d8 - rustc_driver::report_ice::hff78d76a39ffbb86
  11:     0x7f20c5458cb6 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/panicking.rs:595:17
  12:     0x7f20c54587d7 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/panicking.rs:497:13
  13:     0x7f20c5454b7c - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f20c5458739 - rust_begin_unwind
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/panicking.rs:493:5
  15:     0x7f20c54586eb - std::panicking::begin_panic_fmt::hee67ce14b77d0396
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/panicking.rs:435:5
  16:     0x7f20c86f3400 - rustc_middle::ty::query::try_load_from_on_disk_cache::{{closure}}::h0702bbc1f260c0e9
  17:     0x7f20c86f337b - rustc_middle::ty::query::try_load_from_on_disk_cache::hfa4775df5c5e0180
  18:     0x7f20c79cf1ce - rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions::h8caa69177622351e
  19:     0x7f20c79e7aa1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hab5675af7737b3e6
  20:     0x7f20c798a84b - rustc_incremental::persist::save::save_in::h7f4f43356280dc0a
  21:     0x7f20c7985c21 - rustc_data_structures::sync::join::h0120008f852881ce
  22:     0x7f20c79e6b42 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h2893ce60eec57bb6
  23:     0x7f20c7989d7f - rustc_incremental::persist::save::save_dep_graph::hffd3fb2ecc639a78
  24:     0x7f20c786653a - rustc_codegen_ssa::base::finalize_tcx::h68106e2729498b3e
  25:     0x7f20c617ee97 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h067fffb3870bc5b0
  26:     0x7f20c5f2e03e - rustc_session::utils::<impl rustc_session::session::Session>::time::had158f21ec5bf4d1
  27:     0x7f20c5f7052c - rustc_interface::passes::QueryContext::enter::h40067ad7feabcbd0
  28:     0x7f20c5fc87b3 - rustc_interface::queries::Queries::ongoing_codegen::h4fc36fc05972247d
  29:     0x7f20c5cb89e9 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hd899306a06575d0c
  30:     0x7f20c5d39797 - rustc_span::with_source_map::ha4e07ff263d0dc1d
  31:     0x7f20c5cb9b9b - rustc_interface::interface::create_compiler_and_run::h1d6d732867d1f489
  32:     0x7f20c5d66be0 - scoped_tls::ScopedKey<T>::set::h39c0aa543118d3f3
  33:     0x7f20c5d6d1e6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e5aa72fb9cd6d86
  34:     0x7f20c5cc1a5a - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc793837e985b77ce
  35:     0x7f20c546866a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/alloc/src/boxed.rs:1328:9
  36:     0x7f20c546866a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/alloc/src/boxed.rs:1328:9
  37:     0x7f20c546866a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/f0f68778f798d6d34649745b41770829b17ba5b8/library/std/src/sys/unix/thread.rs:71:17
  38:     0x7f20c5394609 - start_thread
  39:     0x7f20c52a8293 - clone
  40:                0x0 - <unknown>

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.50.0-nightly (f0f68778f 2020-12-09) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
end of query stack
error: could not compile `day10`

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions