`Option::unwrap()` on a `None` value in `dep_graph::dep_node::DepNode`
Open
Nobody has claimed this yet.
A-incr-comp
C-bug
I-ICE
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
A minimal patch triggering this bug is this:
@@ -1,5 +1,7 @@
+use rand::Rng;
+
@@ -396,7 +398,7
- let random_scalar = || -> Value { Value::Scalar(Scalar(0)) };
+ let random_scalar = || -> Value { Value::Scalar(Scalar(rand::thread_rng().gen())) };
Meta
rustc --version --verbose:
rustc 1.76.0-nightly (6cf088810 2023-11-26)
Error output
thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:22:85:
called `Option::unwrap()` on a `None` value
[rustc-ice-2023-12-01T19_26_14-11080.txt](https://github.com/rust-lang/rust/files/13531270/rustc-ice-2023-12-01T19_26_14-11080.txt)
Backtrace
thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:22:85:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: 0x7f9dbd59ba2c - std::backtrace_rs::backtrace::libunwind::trace::h971466d927277fa3
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7f9dbd59ba2c - std::backtrace_rs::backtrace::trace_unsynchronized::ha76293b6386c56e4
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f9dbd59ba2c - std::sys_common::backtrace::_print_fmt::hb33088556cc561cb
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7f9dbd59ba2c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he3fa8b304e73d997
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f9dbd5eea70 - core::fmt::rt::Argument::fmt::h84665557d4934c63
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/core/src/fmt/rt.rs:142:9
5: 0x7f9dbd5eea70 - core::fmt::write::h8667946a05524352
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/core/src/fmt/mod.rs:1120:17
6: 0x7f9dbd58f8ef - std::io::Write::write_fmt::hf914cab7f53e0786
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/io/mod.rs:1766:15
7: 0x7f9dbd59b814 - std::sys_common::backtrace::_print::hd306649e608c1f86
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f9dbd59b814 - std::sys_common::backtrace::print::hc78739439a08ea42
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f9dbd59e4a7 - std::panicking::default_hook::{{closure}}::hba6432ae9852ff36
10: 0x7f9dbd59e20f - std::panicking::default_hook::h3031184e6e7f3a1e
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/panicking.rs:292:9
11: 0x7f9dba2f9480 - std[92f7436d37f6400b]::panicking::update_hook::<alloc[2cf79f262efb1c9d]::boxed::Box<rustc_driver_impl[ac0d00980e4e62ab]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7f9dbd59ebe8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7be51e3dc94f2e68
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/alloc/src/boxed.rs:2021:9
13: 0x7f9dbd59ebe8 - std::panicking::rust_panic_with_hook::hdda4d389ef743292
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/panicking.rs:783:13
14: 0x7f9dbd59e909 - std::panicking::begin_panic_handler::{{closure}}::h9ce79f054ccbc771
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/panicking.rs:649:13
15: 0x7f9dbd59bef6 - std::sys_common::backtrace::__rust_end_short_backtrace::h7087f0b95ae57241
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys_common/backtrace.rs:171:18
16: 0x7f9dbd59e6a2 - rust_begin_unwind
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/panicking.rs:645:5
17: 0x7f9dbd5eb145 - core::panicking::panic_fmt::hddf912defe9f1cab
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/core/src/panicking.rs:72:14
18: 0x7f9dbd5eb1f3 - core::panicking::panic::h60815645d660f107
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/core/src/panicking.rs:142:5
19: 0x7f9dbb73ca94 - <rustc_query_system[2959241e02d82320]::dep_graph::dep_node::DepNode as rustc_middle[1557ee54da0b70b7]::dep_graph::dep_node::DepNodeExt>::extract_def_id
20: 0x7f9dbb73d1e0 - rustc_query_impl[5c4dc8ec47f4c245]::plumbing::force_from_dep_node::<rustc_query_impl[5c4dc8ec47f4c245]::DynamicConfig<rustc_query_system[2959241e02d82320]::query::caches::DefaultCache<rustc_span[9b7676b76ade8fc9]::def_id::DefId, rustc_middle[1557ee54da0b70b7]::query::erase::Erased<[u8; 8usize]>>, false, false, false>>
21: 0x7f9dbc4e2c7f - <rustc_query_impl[5c4dc8ec47f4c245]::plumbing::query_callback<rustc_query_impl[5c4dc8ec47f4c245]::query_impl::type_of::QueryType>::{closure#0} as core[5c51d25db8a09f66]::ops::function::FnOnce<(rustc_middle[1557ee54da0b70b7]::ty::context::TyCtxt, rustc_query_system[2959241e02d82320]::dep_graph::dep_node::DepNode)>>::call_once
22: 0x7f9dbb63b67d - <rustc_query_system[2959241e02d82320]::dep_graph::graph::DepGraphData<rustc_middle[1557ee54da0b70b7]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt>
23: 0x7f9dbb63b5f5 - <rustc_query_system[2959241e02d82320]::dep_graph::graph::DepGraphData<rustc_middle[1557ee54da0b70b7]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt>
24: 0x7f9dbb63b5f5 - <rustc_query_system[2959241e02d82320]::dep_graph::graph::DepGraphData<rustc_middle[1557ee54da0b70b7]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt>
25: 0x7f9dbb63b5f5 - <rustc_query_system[2959241e02d82320]::dep_graph::graph::DepGraphData<rustc_middle[1557ee54da0b70b7]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt>
26: 0x7f9dbb63b5f5 - <rustc_query_system[2959241e02d82320]::dep_graph::graph::DepGraphData<rustc_middle[1557ee54da0b70b7]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt>
27: 0x7f9dbb63b5f5 - <rustc_query_system[2959241e02d82320]::dep_graph::graph::DepGraphData<rustc_middle[1557ee54da0b70b7]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt>
28: 0x7f9dbbb9bb32 - rustc_query_system[2959241e02d82320]::query::plumbing::try_execute_query::<rustc_query_impl[5c4dc8ec47f4c245]::DynamicConfig<rustc_query_system[2959241e02d82320]::query::caches::DefaultCache<rustc_middle[1557ee54da0b70b7]::ty::ParamEnvAnd<(rustc_middle[1557ee54da0b70b7]::ty::instance::Instance, &rustc_middle[1557ee54da0b70b7]::ty::list::List<rustc_middle[1557ee54da0b70b7]::ty::Ty>)>, rustc_middle[1557ee54da0b70b7]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt, true>
29: 0x7f9dbbb9a656 - rustc_query_impl[5c4dc8ec47f4c245]::query_impl::fn_abi_of_instance::get_query_incr::__rust_end_short_backtrace
30: 0x7f9db8c4b01e - <rustc_codegen_llvm[82a8cd4aa17f710b]::context::CodegenCx as rustc_codegen_ssa[4e6261f7206c8517]::traits::declare::PreDefineMethods>::predefine_fn
31: 0x7f9dbc23c0db - rustc_codegen_llvm[82a8cd4aa17f710b]::base::compile_codegen_unit::module_codegen
32: 0x7f9dbc533203 - <rustc_codegen_llvm[82a8cd4aa17f710b]::LlvmCodegenBackend as rustc_codegen_ssa[4e6261f7206c8517]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
33: 0x7f9dbbf8216c - rustc_codegen_ssa[4e6261f7206c8517]::base::codegen_crate::<rustc_codegen_llvm[82a8cd4aa17f710b]::LlvmCodegenBackend>
34: 0x7f9dbbf818fa - <rustc_codegen_llvm[82a8cd4aa17f710b]::LlvmCodegenBackend as rustc_codegen_ssa[4e6261f7206c8517]::traits::backend::CodegenBackend>::codegen_crate
35: 0x7f9dbbf7fb85 - rustc_interface[b8b215ac97ffc74d]::passes::start_codegen
36: 0x7f9dbbf7f2df - <rustc_interface[b8b215ac97ffc74d]::queries::Queries>::codegen_and_build_linker
37: 0x7f9dbc53b29e - rustc_interface[b8b215ac97ffc74d]::interface::run_compiler::<core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>, rustc_driver_impl[ac0d00980e4e62ab]::run_compiler::{closure#0}>::{closure#0}
38: 0x7f9dbc4ceb14 - std[92f7436d37f6400b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_with_globals<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_pool_with_globals<rustc_interface[b8b215ac97ffc74d]::interface::run_compiler<core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>, rustc_driver_impl[ac0d00980e4e62ab]::run_compiler::{closure#0}>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>
39: 0x7f9dbc4ce93d - <<std[92f7436d37f6400b]::thread::Builder>::spawn_unchecked_<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_with_globals<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_pool_with_globals<rustc_interface[b8b215ac97ffc74d]::interface::run_compiler<core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>, rustc_driver_impl[ac0d00980e4e62ab]::run_compiler::{closure#0}>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#1} as core[5c51d25db8a09f66]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
40: 0x7f9dbd5a8a85 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb8a1936cb2bbfa85
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/alloc/src/boxed.rs:2007:9
41: 0x7f9dbd5a8a85 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9073c4fb64c8bde9
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/alloc/src/boxed.rs:2007:9
42: 0x7f9dbd5a8a85 - std::sys::unix::thread::Thread::new::thread_start::hd722b95607df8f1b
at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys/unix/thread.rs:108:17
43: 0x7f9db74a8044 - start_thread
at ./nptl/pthread_create.c:442:8
44: 0x7f9db752861c - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
45: 0x0 - <unknown>
error: 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: please attach the file at `/home/greg/s/matx/rustc-ice-2023-12-01T19_26_14-11080.txt` to your bug report
note: compiler flags: --crate-type lib -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C incremental=[REDACTED] -C link-arg=-fuse-ld=lld -C target-cpu=native
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `<common::types::instr::ScalarAluInstr<common::types::instr::MachineRegisters> as core::cmp::PartialEq>::eq`
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 TraitSelect(5640ce22eb2b497c-97b20bb6e8e372ce)
#1 TraitSelect(fc5e20cf2e4687ee-1dee961d7c823a26)
#2 TraitSelect(3ba95303ca105c34-190452460d2425cc)
#3 evaluate_obligation(36295884e6661a27-3d3de8fe450f8113)
#4 is_freeze_raw(b27e71c03d23935f-dbc5a0e33f4f1117)
#5 fn_abi_of_instance(96d99b2c609a8f45-5b84c86cce725c9)
end of try_mark_green dep node stack
error: could not compile `backend` (lib)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the panic using the minimal rand::Rng change and the reported nightly compiler. Start at compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:22 and follow the DepNode::extract_def_id path shown in the backtrace. Done means the reproducer no longer triggers an internal compiler error and the relevant regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100