Repository: rust
Issue: thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:23:54: called `Option::unwrap()` on a `None` value
Labels: I-ICE,T-compiler,A-incr-comp,C-bug,S-needs-repro

This is my first time opening an issue in the Rust repository.

I encountered a rustc error for the first time, and since the error message included "this is a bug," I decided to report it here.

I am developing a program where an embedded device communicates with a host PC. The main crates I am using are:

- tokio
- egui, eframe
- postcard-rpc

This project is private, so I cannot share the entire source code. However, I will try to provide a minimal reproducible example if possible. At the moment, I do not have time to create one, nor I do not have any ideas where to tuckle. I'll read "Rust Bug Minimization Patterns" later...But before reading it(too long!!!!XD), anyway I decided to make an issue first.

I couldn’t figure out what is causing the error, so if you could provide any hints or guidance, I would greatly appreciate it.

<!--
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/
-->

### Code
Sorry, now I can't provide a code. I'll do it later!
```Rust
<code>
```


### 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`:
```
<version>
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-apple-darwin
release: 1.82.0
LLVM version: 19.1.1
```

### Error output

```
<output>
thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:23:54:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:        0x10e76eb26 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hcaf66bc4c0c453df
   1:        0x10baf542b - core::fmt::write::hc9c5f1836b413410
   2:        0x10e7627f2 - std::io::Write::write_fmt::h49df280499063c09
   3:        0x10e7714f8 - std::panicking::default_hook::{{closure}}::h52c0b2f44f6107c5
   4:        0x10e771182 - std::panicking::default_hook::h5a6cf31501c161b2
   5:        0x10c6c189d - std[cb1cdfafde4df3cf]::panicking::update_hook::<alloc[979052cd25504fde]::boxed::Box<rustc_driver_impl[aca610d65443316e]::install_ice_hook::{closure#0}>>::{closure#0}
   6:        0x10e772745 - std::panicking::rust_panic_with_hook::hda4640ee332466e9
   7:        0x10e771b32 - std::panicking::begin_panic_handler::{{closure}}::haa3060694b34ea3d
   8:        0x10e76efd9 - std::sys::backtrace::__rust_end_short_backtrace::h8eb44913cfe71457
   9:        0x10e7717ac - _rust_begin_unwind
  10:        0x11138c2fa - core::panicking::panic_fmt::h31edc3d6ff0aadca
  11:        0x11138c3a4 - core::panicking::panic::hfd2e4211468d1768
  12:        0x11138c248 - core::option::unwrap_failed::h5efa68320d76c7d1
  13:        0x10d2163f1 - <rustc_metadata[47ce8b317361ba99]::rmeta::decoder::cstore_impl::provide_cstore_hooks::{closure#0} as core[4a130405b5326760]::ops::function::FnOnce<(rustc_middle[1883ba4f984b676]::query::plumbing::TyCtxtAt, rustc_span[94136502c03fbd56]::def_id::DefPathHash, rustc_span[94136502c03fbd56]::def_id::StableCrateId)>>::call_once
  14:        0x10d3fbe2b - <rustc_middle[1883ba4f984b676]::ty::context::TyCtxt>::def_path_hash_to_def_id
  15:        0x10dd8751a - rustc_query_impl[abd10f3ee75d8aa1]::plumbing::force_from_dep_node::<rustc_query_impl[abd10f3ee75d8aa1]::DynamicConfig<rustc_query_system[59d7a088f82cb72f]::query::caches::DefIdCache<rustc_middle[1883ba4f984b676]::query::erase::Erased<[u8; 8usize]>>, false, false, false>>
  16:        0x10dd18e19 - <rustc_query_impl[abd10f3ee75d8aa1]::plumbing::query_callback<rustc_query_impl[abd10f3ee75d8aa1]::query_impl::type_of::QueryType>::{closure#0} as core[4a130405b5326760]::ops::function::FnOnce<(rustc_middle[1883ba4f984b676]::ty::context::TyCtxt, rustc_query_system[59d7a088f82cb72f]::dep_graph::dep_node::DepNode)>>::call_once
  17:        0x10dba8dfe - <rustc_query_system[59d7a088f82cb72f]::dep_graph::graph::DepGraphData<rustc_middle[1883ba4f984b676]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt>
  18:        0x10dba8d87 - <rustc_query_system[59d7a088f82cb72f]::dep_graph::graph::DepGraphData<rustc_middle[1883ba4f984b676]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt>
  19:        0x10dba8d87 - <rustc_query_system[59d7a088f82cb72f]::dep_graph::graph::DepGraphData<rustc_middle[1883ba4f984b676]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt>
  20:        0x10dba8d87 - <rustc_query_system[59d7a088f82cb72f]::dep_graph::graph::DepGraphData<rustc_middle[1883ba4f984b676]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt>
  21:        0x10dba8b33 - <rustc_query_system[59d7a088f82cb72f]::dep_graph::graph::DepGraphData<rustc_middle[1883ba4f984b676]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt>
  22:        0x10dbf896c - rustc_query_system[59d7a088f82cb72f]::query::plumbing::try_execute_query::<rustc_query_impl[abd10f3ee75d8aa1]::DynamicConfig<rustc_query_system[59d7a088f82cb72f]::query::caches::DefaultCache<rustc_type_ir[a20e815c0cc40cbe]::canonical::Canonical<rustc_middle[1883ba4f984b676]::ty::context::TyCtxt, rustc_middle[1883ba4f984b676]::ty::ParamEnvAnd<rustc_middle[1883ba4f984b676]::ty::predicate::Predicate>>, rustc_middle[1883ba4f984b676]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt, true>
  23:        0x10de3a90a - rustc_query_impl[abd10f3ee75d8aa1]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
  24:        0x10e553211 - <rustc_infer[48c0d49994c5621c]::infer::InferCtxt as rustc_trait_selection[eda121f7d81737f5]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  25:        0x10e55353d - <rustc_infer[48c0d49994c5621c]::infer::InferCtxt as rustc_trait_selection[eda121f7d81737f5]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  26:        0x10e5434c1 - <rustc_trait_selection[eda121f7d81737f5]::traits::fulfill::FulfillProcessor>::process_trait_obligation
  27:        0x10e54200a - <rustc_trait_selection[eda121f7d81737f5]::traits::fulfill::FulfillProcessor as rustc_data_structures[2abec748834a34ed]::obligation_forest::ObligationProcessor>::process_obligation
  28:        0x10cb8ce75 - <rustc_data_structures[2abec748834a34ed]::obligation_forest::ObligationForest<rustc_trait_selection[eda121f7d81737f5]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[eda121f7d81737f5]::traits::fulfill::FulfillProcessor>
  29:        0x10cc88b46 - <rustc_trait_selection[eda121f7d81737f5]::traits::fulfill::FulfillmentContext<rustc_trait_selection[eda121f7d81737f5]::traits::FulfillmentError> as rustc_infer[48c0d49994c5621c]::traits::engine::TraitEngine<rustc_trait_selection[eda121f7d81737f5]::traits::FulfillmentError>>::select_where_possible
  30:        0x10cd44674 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_argument_types
  31:        0x10cd4337a - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_method_argument_types
  32:        0x10cdff864 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_kind
  33:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  34:        0x10cd53460 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_decl
  35:        0x10cd53eee - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_block_with_expected
  36:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  37:        0x10cd10687 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_return_expr
  38:        0x10cdda71a - rustc_hir_typeck[622e33563e2ec088]::check::check_fn
  39:        0x10cdfec36 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_kind
  40:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  41:        0x10cd44aa8 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_argument_types
  42:        0x10cce3a83 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::confirm_builtin_call
  43:        0x10cdf84ab - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_kind
  44:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  45:        0x10cd44aa8 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_argument_types
  46:        0x10cce3a83 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::confirm_builtin_call
  47:        0x10cdf84ab - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_kind
  48:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  49:        0x10cdee142 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_kind
  50:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  51:        0x10cd53e8e - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_block_with_expected
  52:        0x10cd0e5bf - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  53:        0x10cd10687 - <rustc_hir_typeck[622e33563e2ec088]::fn_ctxt::FnCtxt>::check_return_expr
  54:        0x10cdda71a - rustc_hir_typeck[622e33563e2ec088]::check::check_fn
  55:        0x10cdd46b0 - rustc_hir_typeck[622e33563e2ec088]::typeck
  56:        0x10dd8fa2c - rustc_query_impl[abd10f3ee75d8aa1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[abd10f3ee75d8aa1]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1883ba4f984b676]::query::erase::Erased<[u8; 8usize]>>
  57:        0x10dc2f994 - rustc_query_system[59d7a088f82cb72f]::query::plumbing::try_execute_query::<rustc_query_impl[abd10f3ee75d8aa1]::DynamicConfig<rustc_query_system[59d7a088f82cb72f]::query::caches::VecCache<rustc_span[94136502c03fbd56]::def_id::LocalDefId, rustc_middle[1883ba4f984b676]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt, true>
  58:        0x10ddd9b41 - rustc_query_impl[abd10f3ee75d8aa1]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  59:        0x10caf6aec - rustc_hir_analysis[120c8ebca98fd2c2]::check_crate
  60:        0x10d04fd14 - rustc_interface[8c7d73dd21884758]::passes::run_required_analyses
  61:        0x10d0526ac - rustc_interface[8c7d73dd21884758]::passes::analysis
  62:        0x10dd8fadc - rustc_query_impl[abd10f3ee75d8aa1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[abd10f3ee75d8aa1]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1883ba4f984b676]::query::erase::Erased<[u8; 1usize]>>
  63:        0x10dbdc0ac - rustc_query_system[59d7a088f82cb72f]::query::plumbing::try_execute_query::<rustc_query_impl[abd10f3ee75d8aa1]::DynamicConfig<rustc_query_system[59d7a088f82cb72f]::query::caches::SingleCache<rustc_middle[1883ba4f984b676]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[abd10f3ee75d8aa1]::plumbing::QueryCtxt, true>
  64:        0x10dda82ae - rustc_query_impl[abd10f3ee75d8aa1]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  65:        0x10c6779db - <rustc_interface[8c7d73dd21884758]::queries::QueryResult<&rustc_middle[1883ba4f984b676]::ty::context::GlobalCtxt>>::enter::<core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>, rustc_driver_impl[aca610d65443316e]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
  66:        0x10c6c0042 - rustc_interface[8c7d73dd21884758]::interface::run_compiler::<core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>, rustc_driver_impl[aca610d65443316e]::run_compiler::{closure#0}>::{closure#1}
  67:        0x10c6b07c7 - std[cb1cdfafde4df3cf]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8c7d73dd21884758]::util::run_in_thread_with_globals<rustc_interface[8c7d73dd21884758]::interface::run_compiler<core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>, rustc_driver_impl[aca610d65443316e]::run_compiler::{closure#0}>::{closure#1}, core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>>
  68:        0x10c6c5bca - <<std[cb1cdfafde4df3cf]::thread::Builder>::spawn_unchecked_<rustc_interface[8c7d73dd21884758]::util::run_in_thread_with_globals<rustc_interface[8c7d73dd21884758]::interface::run_compiler<core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>, rustc_driver_impl[aca610d65443316e]::run_compiler::{closure#0}>::{closure#1}, core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4a130405b5326760]::result::Result<(), rustc_span[94136502c03fbd56]::ErrorGuaranteed>>::{closure#1} as core[4a130405b5326760]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  69:        0x10e77d90b - std::sys::pal::unix::thread::Thread::new::thread_start::h55ff15b5f2276bcd
  70:     0x7fff6e0b9109 - __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.82.0 (f6e511eec 2024-10-15) 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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `{coroutine witness@postcard_rpc::host_client::HostClient<postcard_rpc::standard_icd::WireError>::send_resp<k6e_dcap2_common::icd::ProjectCommandEndpoint>::{closure#0}}: core::marker::Send`
#1 [typeck] type-checking `app::run`
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 TraitSelect(da253ef9e1c0301d-d59ba1c5604ee998)
#1 TraitSelect(995cde0fe76c64d4-2fc80b69fa2bffe)
#2 TraitSelect(c2206d994b90fa71-3a71e4da02677409)
#3 evaluate_obligation(fb2de09ea71bf4e2-6748f5794fb6fb62)
end of try_mark_green dep node stack
```
 I also did `RUST_BACKTRACE=1 cargo build` and the message was the same.
</p>
</details>