Closed
Description
I'm getting an ICE when compiling some of my code.
Unfortunately, it has resisted all my attempts at producing a smaller code sample. It's very finicky.
I have uploaded a reproducible repo here: https://github.com/HalfVoxel/graphica/tree/rustc-replicate, unfortunately it's quite a lot of code. The code that seems to trigger it is this:
fn hash_material(material: &Material, changes: &[BindGroupEntryArc]) -> u64 {
let mut hasher = std::collections::hash_map::DefaultHasher::default();
std::ptr::hash(Arc::as_ptr(&material.bind_group_layout.0), &mut hasher);
hasher.finish()
}
However, I have been unable to replicate it in a smaller project.
Meta
rustc --version --verbose
:
rustc 1.55.0-nightly (ce1d5611a 2021-06-18)
binary: rustc
commit-hash: ce1d5611a28468663e275078649e7ca6eef735a8
commit-date: 2021-06-18
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
The bug exists both in the current nightly compiler and the current stable compiler.
Error output
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_mir/src/monomorphize/collector.rs:884:93
This is the location in rustc where it crashes:
Backtrace
<backtrace>
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_mir/src/monomorphize/collector.rs:884:93
stack backtrace:
0: rust_begin_unwind
at /rustc/ce1d5611a28468663e275078649e7ca6eef735a8/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/ce1d5611a28468663e275078649e7ca6eef735a8/library/core/src/panicking.rs:92:14
2: core::panicking::panic
at /rustc/ce1d5611a28468663e275078649e7ca6eef735a8/library/core/src/panicking.rs:50:5
3: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
4: rustc_mir::monomorphize::collector::collect_neighbours
5: rustc_mir::monomorphize::collector::collect_items_rec
6: rustc_mir::monomorphize::collector::collect_items_rec
7: rustc_mir::monomorphize::collector::collect_items_rec
8: rustc_mir::monomorphize::collector::collect_items_rec
9: rustc_mir::monomorphize::collector::collect_items_rec
10: rustc_mir::monomorphize::collector::collect_items_rec
11: rustc_mir::monomorphize::collector::collect_items_rec
12: rustc_mir::monomorphize::collector::collect_items_rec
13: rustc_mir::monomorphize::collector::collect_items_rec
14: rustc_mir::monomorphize::collector::collect_items_rec
15: rustc_mir::monomorphize::collector::collect_items_rec
16: rustc_mir::monomorphize::collector::collect_items_rec
17: rustc_session::utils::<impl rustc_session::session::Session>::time
18: rustc_mir::monomorphize::collector::collect_crate_mono_items
19: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
20: rustc_query_system::query::plumbing::get_query_impl
21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
22: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
23: rustc_query_system::query::plumbing::get_query_impl
24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::exported_symbols
25: rustc_metadata::rmeta::encoder::EncodeContext::encode_crate_root
26: rustc_metadata::rmeta::encoder::encode_metadata_impl
27: rustc_data_structures::sync::join
28: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata
29: rustc_middle::ty::context::TyCtxt::encode_metadata
30: rustc_interface::passes::QueryContext::enter
31: rustc_interface::queries::Queries::ongoing_codegen
32: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
33: rustc_span::with_source_map
34: rustc_interface::interface::create_compiler_and_run
35: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.55.0-nightly (ce1d5611a 2021-06-18) running on x86_64-unknown-linux-gnu
note: compiler flags: -C opt-level=z -C embed-bitcode=no --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
</p>
</details>