Repository: rust
Issue: ICE: no warnings or errors encountered even though `delayed_good_path_bugs` issued
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/
-->

Sporadic ICE when compiling a crate occurred, I could not reproduce this issue after the initial occurrence.

### 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.66.0-nightly (758f19645 2022-10-24)
binary: rustc
commit-hash: 758f19645b8ebce61ea52d1f6672fd057bc8dbee
commit-date: 2022-10-24
host: x86_64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2
```

### Error output

```
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: trimmed_def_paths constructed
```

<!--
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>

```
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: trimmed_def_paths constructed
  |
  = note: delayed at    0: std::backtrace::Backtrace::create
             1: std::backtrace::Backtrace::force_capture
             2: <rustc_errors::Handler>::delay_good_path_bug::<&str>
             3: rustc_middle::ty::print::pretty::trimmed_def_paths
             4: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), std::collections::hash::map::HashMap<rustc_span::def_id::DefId, rustc_span::symbol::Symbol, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>>
             5: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::ArenaCache<(), std::collections::hash::map::HashMap<rustc_span::def_id::DefId, rustc_span::symbol::Symbol, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>>>
             6: rustc_query_system::query::plumbing::force_query::<rustc_query_impl::queries::trimmed_def_paths, rustc_query_impl::plumbing::QueryCtxt>
             7: rustc_query_impl::plumbing::force_from_dep_node::<rustc_query_impl::queries::trimmed_def_paths>
             8: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
             9: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_green::<rustc_query_impl::plumbing::QueryCtxt>
            10: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl::plumbing::QueryCtxt, rustc_middle::ty::instance::InstanceDef, rustc_middle::mir::Body>
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::ArenaCache<rustc_middle::ty::instance::InstanceDef, rustc_middle::mir::Body>>
            12: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::mir_shims, rustc_query_impl::plumbing::QueryCtxt>
            13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_shims
            14: <rustc_middle::ty::context::TyCtxt>::instance_mir
            15: rustc_monomorphize::collector::collect_neighbours
            16: rustc_monomorphize::collector::collect_items_rec
            17: rustc_monomorphize::collector::collect_items_rec
            18: <core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::par_for_each_in<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> as core::ops::function::FnOnce<()>>::call_once
            19: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
            20: rustc_monomorphize::collector::collect_crate_mono_items
            21: rustc_monomorphize::partitioning::collect_and_partition_mono_items
            22: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), (&std::collections::hash::set::HashSet<rustc_span::def_id::DefId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>, &[rustc_middle::mir::mono::CodegenUnit])>
            23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), (&std::collections::hash::set::HashSet<rustc_span::def_id::DefId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>, &[rustc_middle::mir::mono::CodegenUnit])>>
            24: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::collect_and_partition_mono_items, rustc_query_impl::plumbing::QueryCtxt>
            25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
            26: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
            27: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
            28: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
            29: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorGuaranteed>>
            30: <rustc_interface::queries::Queries>::ongoing_codegen
            31: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
            32: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            33: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            34: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            35: std::sys::unix::thread::Thread::new::thread_start
            36: __pthread_start
          

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1553:13
stack backtrace:
   0:        0x106972962 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0617dd5fbbe552dc
   1:        0x1069ca73a - core::fmt::write::h05a6134c72ed1ddb
   2:        0x106964a3c - std::io::Write::write_fmt::he80e9ff25b029579
   3:        0x10697272a - std::sys_common::backtrace::print::h1700815a3ed92180
   4:        0x106975b36 - std::panicking::default_hook::{{closure}}::hd84f668f3afedf6e
   5:        0x106975887 - std::panicking::default_hook::hf57a9610d4322109
   6:        0x10f595acd - rustc_driver[479c34f3865e3b6c]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x106976331 - std::panicking::rust_panic_with_hook::h73409f7b338a4bac
   8:        0x113f65107 - std[897bb1241874467f]::panicking::begin_panic::<rustc_errors[2c7ec5b3ac012aec]::ExplicitBug>::{closure#0}
   9:        0x113f63139 - std[897bb1241874467f]::sys_common::backtrace::__rust_end_short_backtrace::<std[897bb1241874467f]::panicking::begin_panic<rustc_errors[2c7ec5b3ac012aec]::ExplicitBug>::{closure#0}, !>
  10:        0x114329ae9 - std[897bb1241874467f]::panicking::begin_panic::<rustc_errors[2c7ec5b3ac012aec]::ExplicitBug>
  11:        0x113f55279 - std[897bb1241874467f]::panic::panic_any::<rustc_errors[2c7ec5b3ac012aec]::ExplicitBug>
  12:        0x113f587db - <rustc_errors[2c7ec5b3ac012aec]::HandlerInner as core[22281634348f74b5]::ops::drop::Drop>::drop
  13:        0x10f517f8a - core[22281634348f74b5]::ptr::drop_in_place::<rustc_session[35ea78c76e8a82fc]::parse::ParseSess>
  14:        0x10f51970b - core[22281634348f74b5]::ptr::drop_in_place::<rustc_session[35ea78c76e8a82fc]::session::Session>
  15:        0x10f58251e - core[22281634348f74b5]::ptr::drop_in_place::<rustc_interface[ad26a51231c6738a]::interface::Compiler>
  16:        0x10f568af9 - rustc_span[aadd19664503651e]::with_source_map::<core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>, rustc_interface[ad26a51231c6738a]::interface::run_compiler<core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>, rustc_driver[479c34f3865e3b6c]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  17:        0x10f558efc - <scoped_tls[390179035351303f]::ScopedKey<rustc_span[aadd19664503651e]::SessionGlobals>>::set::<rustc_interface[ad26a51231c6738a]::interface::run_compiler<core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>, rustc_driver[479c34f3865e3b6c]::run_compiler::{closure#1}>::{closure#0}, core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>>
  18:        0x10f52892a - std[897bb1241874467f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ad26a51231c6738a]::util::run_in_thread_pool_with_globals<rustc_interface[ad26a51231c6738a]::interface::run_compiler<core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>, rustc_driver[479c34f3865e3b6c]::run_compiler::{closure#1}>::{closure#0}, core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>>
  19:        0x10f50e5eb - <<std[897bb1241874467f]::thread::Builder>::spawn_unchecked_<rustc_interface[ad26a51231c6738a]::util::run_in_thread_pool_with_globals<rustc_interface[ad26a51231c6738a]::interface::run_compiler<core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>, rustc_driver[479c34f3865e3b6c]::run_compiler::{closure#1}>::{closure#0}, core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[22281634348f74b5]::result::Result<(), rustc_errors[2c7ec5b3ac012aec]::ErrorGuaranteed>>::{closure#1} as core[22281634348f74b5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:        0x10697f447 - std::sys::unix::thread::Thread::new::thread_start::hadbe903a2d919b07
  21:     0x7ff803772259 - __pthread_start

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.66.0-nightly (758f19645 2022-10-24) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
```

</p>
</details>