Repository: rust
Issue: ICE: thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:22:85
Labels: I-ICE,T-compiler,C-bug,S-needs-repro

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

I'm trying to make a small reproducible. Currently what can be provided is the following info:


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.76.0 (07dca489a 2024-02-04)

```

### 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

```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
stack backtrace:
   0:        0x1048406b5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbd71adb7a72f4105
   1:        0x10488d5a3 - core::fmt::write::h30346430340bc336
   2:        0x104836a9e - std::io::Write::write_fmt::heb3d6316c565d5b1
   3:        0x104840489 - std::sys_common::backtrace::print::h67e51ff2e3d5cfbd
   4:        0x104843775 - std::panicking::default_hook::{{closure}}::hc666c9a55318d1f1
   5:        0x1048434ee - std::panicking::default_hook::hf980b1da49948523
   6:        0x10e30ef4e - <alloc[7e347fc420f5e846]::boxed::Box<rustc_driver_impl[12f52051d44d1c06]::install_ice_hook::{closure#0}> as core[fdc98393f43b060c]::ops::function::Fn<(&dyn for<'a, 'b> core[fdc98393f43b060c]::ops::function::Fn<(&'a core[fdc98393f43b060c]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[fdc98393f43b060c]::marker::Send + core[fdc98393f43b060c]::marker::Sync, &core[fdc98393f43b060c]::panic::panic_info::PanicInfo)>>::call
   7:        0x104843e35 - std::panicking::rust_panic_with_hook::h683bce980186bbbe
   8:        0x104843b8c - std::panicking::begin_panic_handler::{{closure}}::ha6dbd11ba0ec8af1
   9:        0x104840ba9 - std::sys_common::backtrace::__rust_end_short_backtrace::h889430bddc786c98
  10:        0x104843902 - _rust_begin_unwind
  11:        0x1048a9b05 - core::panicking::panic_fmt::hff768cef35397791
  12:        0x1048a9bd7 - core::panicking::panic::h4b431f82891b8f60
  13:        0x10ece03a8 - <rustc_metadata[d0eddb2578075599]::creader::CStore as rustc_session[7ea90fd6e3c1ca21]::cstore::CrateStore>::def_path_hash_to_def_id
  14:        0x10ee4577c - <rustc_middle[461b0e2f47a02e98]::ty::context::TyCtxt>::def_path_hash_to_def_id
  15:        0x10f74ce01 - <rustc_query_impl[149d578d97f1150d]::plumbing::query_callback<rustc_query_impl[149d578d97f1150d]::query_impl::type_of::QueryType>::{closure#0} as core[fdc98393f43b060c]::ops::function::FnOnce<(rustc_middle[461b0e2f47a02e98]::ty::context::TyCtxt, rustc_query_system[b3462f551eed1440]::dep_graph::dep_node::DepNode)>>::call_once
  16:        0x10f7b030c - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  17:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  18:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  19:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  20:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  21:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  22:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  23:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  24:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  25:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  26:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  27:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  28:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  29:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  30:        0x10f7b00a6 - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  31:        0x10f6cef4e - rustc_query_system[b3462f551eed1440]::query::plumbing::try_execute_query::<rustc_query_impl[149d578d97f1150d]::DynamicConfig<rustc_query_system[b3462f551eed1440]::query::caches::DefaultCache<rustc_type_ir[9c5f3822bfadb3cb]::canonical::Canonical<rustc_middle[461b0e2f47a02e98]::ty::context::TyCtxt, rustc_middle[461b0e2f47a02e98]::ty::ParamEnvAnd<rustc_middle[461b0e2f47a02e98]::ty::Predicate>>, rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt, true>
  32:        0x10f93a8c2 - rustc_query_impl[149d578d97f1150d]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
  33:        0x10fe01c34 - <rustc_infer[1667a4554fda261a]::infer::InferCtxt as rustc_trait_selection[356d25d546d75df8]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  34:        0x10fe01ff1 - <rustc_infer[1667a4554fda261a]::infer::InferCtxt as rustc_trait_selection[356d25d546d75df8]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  35:        0x10fedeb11 - <rustc_trait_selection[356d25d546d75df8]::traits::fulfill::FulfillProcessor>::process_trait_obligation
  36:        0x10fedd4c2 - <rustc_trait_selection[356d25d546d75df8]::traits::fulfill::FulfillProcessor as rustc_data_structures[703faeb0d5a8276e]::obligation_forest::ObligationProcessor>::process_obligation
  37:        0x10fec448a - <rustc_data_structures[703faeb0d5a8276e]::obligation_forest::ObligationForest<rustc_trait_selection[356d25d546d75df8]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[356d25d546d75df8]::traits::fulfill::FulfillProcessor>
  38:        0x10feda657 - <rustc_trait_selection[356d25d546d75df8]::traits::fulfill::FulfillmentContext as rustc_infer[1667a4554fda261a]::traits::engine::TraitEngine>::select_where_possible
  39:        0x10e609a93 - rustc_hir_analysis[53aeebf088699e77]::check::compare_impl_item::collect_return_position_impl_trait_in_trait_tys
  40:        0x10f76a751 - rustc_query_impl[149d578d97f1150d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[149d578d97f1150d]::query_impl::collect_return_position_impl_trait_in_trait_tys::dynamic_query::{closure#2}::{closure#0}, rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 8usize]>>
  41:        0x10f946eef - <rustc_query_impl[149d578d97f1150d]::query_impl::collect_return_position_impl_trait_in_trait_tys::dynamic_query::{closure#2} as core[fdc98393f43b060c]::ops::function::FnOnce<(rustc_middle[461b0e2f47a02e98]::ty::context::TyCtxt, rustc_span[bbb3e06ffdf798f9]::def_id::DefId)>>::call_once
  42:        0x10f6f49b5 - rustc_query_system[b3462f551eed1440]::query::plumbing::try_execute_query::<rustc_query_impl[149d578d97f1150d]::DynamicConfig<rustc_query_system[b3462f551eed1440]::query::caches::DefaultCache<rustc_span[bbb3e06ffdf798f9]::def_id::DefId, rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt, true>
  43:        0x10f6a8ad3 - rustc_query_system[b3462f551eed1440]::query::plumbing::force_query::<rustc_query_impl[149d578d97f1150d]::DynamicConfig<rustc_query_system[b3462f551eed1440]::query::caches::DefaultCache<rustc_span[bbb3e06ffdf798f9]::def_id::DefId, rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  44:        0x10f74c219 - <rustc_query_impl[149d578d97f1150d]::plumbing::query_callback<rustc_query_impl[149d578d97f1150d]::query_impl::collect_return_position_impl_trait_in_trait_tys::QueryType>::{closure#0} as core[fdc98393f43b060c]::ops::function::FnOnce<(rustc_middle[461b0e2f47a02e98]::ty::context::TyCtxt, rustc_query_system[b3462f551eed1440]::dep_graph::dep_node::DepNode)>>::call_once
  45:        0x10f7b030c - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  46:        0x10f7b036e - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  47:        0x10f7b00a6 - <rustc_query_system[b3462f551eed1440]::dep_graph::graph::DepGraphData<rustc_middle[461b0e2f47a02e98]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  48:        0x10f6ac12d - rustc_query_system[b3462f551eed1440]::query::plumbing::ensure_must_run::<rustc_query_impl[149d578d97f1150d]::DynamicConfig<rustc_query_system[b3462f551eed1440]::query::caches::VecCache<rustc_span[bbb3e06ffdf798f9]::def_id::LocalDefId, rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt>
  49:        0x10f91c246 - rustc_query_impl[149d578d97f1150d]::query_impl::check_mod_impl_wf::get_query_incr::__rust_end_short_backtrace
  50:        0x10e623ea9 - <rustc_middle[461b0e2f47a02e98]::hir::map::Map>::for_each_module::<rustc_hir_analysis[53aeebf088699e77]::check_crate::{closure#2}::{closure#0}::{closure#0}>
  51:        0x10e5d8d38 - rustc_hir_analysis[53aeebf088699e77]::check_crate
  52:        0x10eb14cdf - rustc_interface[b53b3eb5bb998bb1]::passes::analysis
  53:        0x10f76a96d - rustc_query_impl[149d578d97f1150d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[149d578d97f1150d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 1usize]>>
  54:        0x10f8015e9 - <rustc_query_impl[149d578d97f1150d]::query_impl::analysis::dynamic_query::{closure#2} as core[fdc98393f43b060c]::ops::function::FnOnce<(rustc_middle[461b0e2f47a02e98]::ty::context::TyCtxt, ())>>::call_once
  55:        0x10f6b3a23 - rustc_query_system[b3462f551eed1440]::query::plumbing::try_execute_query::<rustc_query_impl[149d578d97f1150d]::DynamicConfig<rustc_query_system[b3462f551eed1440]::query::caches::SingleCache<rustc_middle[461b0e2f47a02e98]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[149d578d97f1150d]::plumbing::QueryCtxt, true>
  56:        0x10f90b714 - rustc_query_impl[149d578d97f1150d]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  57:        0x10e2a8151 - <rustc_middle[461b0e2f47a02e98]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[12f52051d44d1c06]::run_compiler::{closure#0}::{closure#0}::{closure#3}, core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>>
  58:        0x10e2d4b72 - <rustc_interface[b53b3eb5bb998bb1]::interface::Compiler>::enter::<rustc_driver_impl[12f52051d44d1c06]::run_compiler::{closure#0}::{closure#0}, core[fdc98393f43b060c]::result::Result<core[fdc98393f43b060c]::option::Option<rustc_interface[b53b3eb5bb998bb1]::queries::Linker>, rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>>
  59:        0x10e2c0672 - rustc_span[bbb3e06ffdf798f9]::create_session_globals_then::<core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>, rustc_interface[b53b3eb5bb998bb1]::interface::run_compiler<core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>, rustc_driver_impl[12f52051d44d1c06]::run_compiler::{closure#0}>::{closure#0}>
  60:        0x10e2fff75 - std[ccb858c55971878c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b53b3eb5bb998bb1]::util::run_in_thread_with_globals<rustc_interface[b53b3eb5bb998bb1]::interface::run_compiler<core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>, rustc_driver_impl[12f52051d44d1c06]::run_compiler::{closure#0}>::{closure#0}, core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>>
  61:        0x10e2ca16e - <<std[ccb858c55971878c]::thread::Builder>::spawn_unchecked_<rustc_interface[b53b3eb5bb998bb1]::util::run_in_thread_with_globals<rustc_interface[b53b3eb5bb998bb1]::interface::run_compiler<core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>, rustc_driver_impl[12f52051d44d1c06]::run_compiler::{closure#0}>::{closure#0}, core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fdc98393f43b060c]::result::Result<(), rustc_span[bbb3e06ffdf798f9]::ErrorGuaranteed>>::{closure#1} as core[fdc98393f43b060c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  62:        0x10484d249 - std::sys::unix::thread::Thread::new::thread_start::hcdd70219a480b010
  63:     0x7ff81aee0202 - __pthread_start

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: rustc 1.76.0 (07dca489a 2024-02-04) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden


```

</p>
</details>