Description
Hey, I hit this ICE while working on cranelift and I don't really know how to minimize it. Its a huge project.
This seems to be related (possibly a dup) of #97143.
Code
Since it may be incremental compilation (see #97143) related I have two branches, one before the ICE and one that triggers the ICE.
Here's the example code before the crash
https://github.com/afonso360/wasmtime/tree/rustc-ice-repro-before
and after
https://github.com/afonso360/wasmtime/tree/rustc-ice-repro-after
To reproduce do the following:
- Clone
rustc-ice-repro-before
git submodule update --init
cd cranelift
cargo build
(this fails to compile, but that's okay)git checkout rustc-ice-repro-after
cargo build
This seems to trigger the ICE even after cargo clean
. Doing a cargo clean
and then compiling rustc-ice-repro-after
fixes the issue. However going from rustc-ice-repro-before
to rustc-ice-repro-after
reliably triggers the ICE for me.
Meta
rustc --version --verbose
:
rustc 1.64.0-nightly (6dba4ed21 2022-07-09)
binary: rustc
commit-hash: 6dba4ed215e7a60f0a2a19c04f3f73691f89c509
commit-date: 2022-07-09
host: x86_64-pc-windows-msvc
release: 1.64.0-nightly
LLVM version: 14.0.6
Error output
PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo build
Compiling cranelift-codegen v0.87.0 (C:\Users\Afonso\CLionProjects\wasmtime\cranelift\codegen)
thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id 1aa453c779adf6fd-53c00101e38ec6ab', compiler\rustc_middle\src\dep_graph\dep_node.rs:276:17
stack backtrace:
0: 0x7ffddb9195af - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hef23f45976deca92
1: 0x7ffddb953dca - core::fmt::write::hd395a3407025fcd0
2: 0x7ffddb90c4fa - <std::io::IoSlice as core::fmt::Debug>::fmt::h34f34bee4af4de43
3: 0x7ffddb91cf0b - std::panicking::default_hook::h760161844aaa65ca
4: 0x7ffddb91cb37 - std::panicking::default_hook::h760161844aaa65ca
5: 0x7ffdba9b5b96 - <rustc_session[e0d8b14a64b556fe]::options::WasiExecModel as rustc_session[e0d8b14a64b556fe]::config::dep_tracking::DepTrackingHash>::hash
6: 0x7ffddb91d8ec - std::panicking::rust_panic_with_hook::h6c74749b84247d66
7: 0x7ffddb91d66d - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h1c8e82c7514048d5
8: 0x7ffddb91a297 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hef23f45976deca92
9: 0x7ffddb91d340 - rust_begin_unwind
10: 0x7ffddb989d75 - core::panicking::panic_fmt::hb22ecb829d7a5b44
11: 0x7ffdbeeb450f - <rustc_query_system[c54040d80f7bd67d]::dep_graph::dep_node::DepNode<rustc_middle[e2a3c9cfc670f53f]::dep_graph::dep_node::DepKind> as rustc_middle[e2a3c9cfc670f53f]::dep_grap
h::dep_node::DepNodeExt>::extract_def_id
12: 0x7ffdbef369a5 - <rustc_middle[e2a3c9cfc670f53f]::ty::context::TyCtxt>::def_path_hash_to_def_id
13: 0x7ffdbeeb4474 - <rustc_query_system[c54040d80f7bd67d]::dep_graph::dep_node::DepNode<rustc_middle[e2a3c9cfc670f53f]::dep_graph::dep_node::DepKind> as rustc_middle[e2a3c9cfc670f53f]::dep_grap
h::dep_node::DepNodeExt>::extract_def_id
14: 0x7ffdbe018d23 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
15: 0x7ffdbef1c563 - <rustc_middle[e2a3c9cfc670f53f]::ty::context::TyCtxt as rustc_query_system[c54040d80f7bd67d]::dep_graph::DepContext>::try_force_from_dep_node
16: 0x7ffdbe28910e - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
17: 0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
18: 0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
19: 0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
20: 0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
21: 0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
22: 0x7ffdbe261580 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
23: 0x7ffdbe098f36 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
24: 0x7ffdbe256e43 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
25: 0x7ffdbd2b5774 - <rustc_builtin_macros[bf80a4e64d368975]::format_foreign::shell::Substitution as core[6cb971d316fff487]::fmt::Debug>::fmt
26: 0x7ffdbd48cd73 - <rustc_typeck[f2237eae730687b5]::check::MaybeInProgressTables>::borrow_mut
27: 0x7ffdbdfdb56e - <&[rustc_span[aee144ca6db227e2]::def_id::LocalDefId] as rustc_serialize[d6267468a4d4c477]::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecod
er>>::decode
28: 0x7ffdbe2cc38f - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
29: 0x7ffdbe17fffd - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
30: 0x7ffdbe204d39 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
31: 0x7ffdbd492025 - <rustc_typeck[f2237eae730687b5]::constrained_generic_params::Parameter as core[6cb971d316fff487]::fmt::Debug>::fmt
32: 0x7ffdbd2fb8a5 - rustc_typeck[f2237eae730687b5]::check_crate
33: 0x7ffdbaaa368f - rustc_interface[76bb9c439a2899ad]::passes::analysis
34: 0x7ffdbdfdb2de - <&[rustc_span[aee144ca6db227e2]::def_id::LocalDefId] as rustc_serialize[d6267468a4d4c477]::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecod
er>>::decode
35: 0x7ffdbe2c2baf - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
36: 0x7ffdbe16d901 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
37: 0x7ffdbe2572c6 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
38: 0x7ffdba95f476 - <rustc_middle[e2a3c9cfc670f53f]::ty::SymbolName as core[6cb971d316fff487]::fmt::Debug>::fmt
39: 0x7ffdba9443dd - <chalk_engine[4f5fa8a5a4054be1]::TableIndex>::increment
40: 0x7ffdba9adf37 - <rustc_session[e0d8b14a64b556fe]::options::WasiExecModel as rustc_session[e0d8b14a64b556fe]::config::dep_tracking::DepTrackingHash>::hash
41: 0x7ffdba946b66 - <chalk_engine[4f5fa8a5a4054be1]::TableIndex>::increment
42: 0x7ffdba94c3c8 - <rustc_middle[e2a3c9cfc670f53f]::ty::SymbolName as core[6cb971d316fff487]::fmt::Debug>::fmt
43: 0x7ffddb92dbac - std::sys::windows::thread::Thread::new::h37d5bf4d23586b2f
44: 0x7ffe55c57034 - BaseThreadInitThunk
45: 0x7ffe56d82651 - 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.64.0-nightly (6dba4ed21 2022-07-09) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck_item_bodies] type-checking all item bodies
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `cranelift-codegen`
PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift>
Backtrace
<backtrace>