Repository: rust
Issue: -Z meta-stats + RUSTC_LOG=info ICEs on next build
Labels: A-diagnostics,I-ICE,T-compiler,C-bug,requires-nightly,S-has-bisection

1. run `cargo new --bin meta` to prepare.

main.rs:
```rust
fn main() {
    println!("Hello, world!");
} 
```

2. first run `RUSTC_LOG=info RUSTFLAGS=-Zmeta-stats cargo b`
3. next run `cargo b`, which ICEs.


### 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.86.0-nightly (649b995a9 2025-01-22)
binary: rustc
commit-hash: 649b995a9febd658b2570160703dff6fdc038ab2
commit-date: 2025-01-22
host: x86_64-pc-windows-msvc
release: 1.86.0-nightly
LLVM version: 19.1.7
```

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

```
thread 'rustc' panicked at compiler\rustc_errors\src\lib.rs:645:17:
`trimmed_def_paths` called, diagnostics were expected but none were emitted. Use `with_no_trimmed_paths` for debugging. Backtraces are currently disabled: set `RUST_BACKTRACE=1` and re-run to see where it happened.
stack backtrace:
   0:     0x7ffc38211473 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffc38211473 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffc38211473 - std::backtrace::Backtrace::create
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\backtrace.rs:331
   3:     0x7ffc382113ba - std::backtrace::Backtrace::force_capture
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\backtrace.rs:312
   4:     0x7ffc3983d05b - core[991f9e90141a1bf]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[bb1ce1a6c5adb18f]::Level, &str), usize), <((rustc_lint_defs[bb1ce1a6c5adb18f]::Level, &str), usize) as core[991f9e90141a1bf]::cmp::PartialOrd>::lt>
   5:     0x7ffc3822d61e - alloc::boxed::impl$30::call
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2027
   6:     0x7ffc3822d61e - std::panicking::rust_panic_with_hook
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\panicking.rs:839
   7:     0x7ffc3822d379 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\panicking.rs:704
   8:     0x7ffc3822a77f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\sys\backtrace.rs:168
   9:     0x7ffc3822cf7e - std::panicking::begin_panic_handler
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\panicking.rs:695
  10:     0x7ffc3b0fed41 - core::panicking::panic_fmt
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\core\src\panicking.rs:75
  11:     0x7ffc38199a51 - <rustc_errors[42171fc74e8af5b8]::DiagCtxtInner as core[991f9e90141a1bf]::ops::drop::Drop>::drop
  12:     0x7ffc35215040 - _rust_alloc_error_handler
  13:     0x7ffc3523956d - _rust_alloc_error_handler
  14:     0x7ffc35236ca6 - _rust_alloc_error_handler
  15:     0x7ffc35247492 - RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  16:     0x7ffc35240259 - RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs3zgY6wvIJ9S_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCslzhJIxFyRmJ_17rustc_driver_i
  17:     0x7ffc35253583 - RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  18:     0x7ffc3823f6ad - alloc::boxed::impl$28::call_once
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2013
  19:     0x7ffc3823f6ad - alloc::boxed::impl$28::call_once
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2013
  20:     0x7ffc3823f6ad - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\sys\pal\windows\thread.rs:56
  21:     0x7ffc97117374 - BaseThreadInitThunk
  22:     0x7ffc9725cc91 - RtlUserThreadStart


rustc version: 1.86.0-nightly (649b995a9 2025-01-22)
platform: x86_64-pc-windows-msvc
```

</p>
</details>

<details><summary><strong>Backtrace with RUST_BACKTRACE=1 </strong></summary>
<p>

```
thread 'rustc' panicked at compiler\rustc_errors\src\lib.rs:645:17:
`trimmed_def_paths` called, diagnostics were expected but none were emitted. Use `with_no_trimmed_paths` for debugging. This happened in the following `must_produce_diag` call's backtrace:
   0: std::backtrace_rs::backtrace::dbghelp64::trace
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2: std::backtrace::Backtrace::create
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\backtrace.rs:331
   3: std::backtrace::Backtrace::capture
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\backtrace.rs:296
   4: <rustc_errors::DiagCtxtHandle>::set_must_produce_diag
   5: <rustc_session::session::Session>::record_trimmed_def_paths
   6: rustc_middle::ty::print::pretty::trimmed_def_paths
   7: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::depth_limit_error
   8: RINvNtNtCsapybXMd6BZ5_18rustc_query_system5query8plumbing17try_execute_queryINtCscpBx8nL7yzV_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs3PZcMoxADy4_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
   9: <alloc::raw_vec::RawVec<(rustc_query_system::dep_graph::serialized::SerializedDepNodeIndex, rustc_middle::query::on_disk_cache::AbsoluteBytePos)>>::grow_one
  10: <rustc_query_system::query::plumbing::JobOwner<()> as core::ops::drop::Drop>::drop
  11: RINvMs6_NtCs9qXCY6i3qbL_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs3PZcMoxADy4_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCsapybXMd6BZ5_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  12: RINvMs6_NtCs9qXCY6i3qbL_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs3PZcMoxADy4_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCsapybXMd6BZ5_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  13: RINvMs6_NtCs9qXCY6i3qbL_9hashbrown3rawINtB6_8RawTableTTNtNtNtCs3PZcMoxADy4_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCsapybXMd6BZ5_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  14: RINvNtNtCsapybXMd6BZ5_18rustc_query_system5query8plumbing15ensure_must_runINtCscpBx8nL7yzV_16rustc_query_impl13DynamicConfigINtNtCshneqGBW248W_21rustc_data_structures9vec_cache8VecCacheNtNtCsc129ZB59tsZ_10rustc_span6def_id10LocalDefIdINtNtNtCs3PZcMoxADy4_1
  15: rustc_query_impl::query_system
  16: rustc_interface::passes::resolver_for_lowering_raw
  17: rustc_interface::passes::analysis
  18: <alloc::raw_vec::RawVec<(rustc_query_system::dep_graph::serialized::SerializedDepNodeIndex, rustc_middle::query::on_disk_cache::AbsoluteBytePos)>>::grow_one
  19: RINvNtNtCsapybXMd6BZ5_18rustc_query_system5query8plumbing17try_execute_queryINtCscpBx8nL7yzV_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs3PZcMoxADy4_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  20: rustc_query_impl::query_system
  21: RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  22: RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  23: RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs3zgY6wvIJ9S_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCslzhJIxFyRmJ_17rustc_driver_i
  24: RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  25: alloc::boxed::impl$28::call_once
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2013
  26: alloc::boxed::impl$28::call_once
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2013
  27: std::sys::pal::windows::thread::impl$0::new::thread_start
             at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\sys\pal\windows\thread.rs:56
  28: BaseThreadInitThunk
  29: RtlUserThreadStart

stack backtrace:
   0:     0x7ffc38211473 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffc38211473 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffc38211473 - std::backtrace::Backtrace::create
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\backtrace.rs:331
   3:     0x7ffc382113ba - std::backtrace::Backtrace::force_capture
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\backtrace.rs:312
   4:     0x7ffc3983d05b - core[991f9e90141a1bf]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[bb1ce1a6c5adb18f]::Level, &str), usize), <((rustc_lint_defs[bb1ce1a6c5adb18f]::Level, &str), usize) as core[991f9e90141a1bf]::cmp::PartialOrd>::lt>
   5:     0x7ffc3822d61e - alloc::boxed::impl$30::call
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2027
   6:     0x7ffc3822d61e - std::panicking::rust_panic_with_hook
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\panicking.rs:839
   7:     0x7ffc3822d379 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\panicking.rs:704
   8:     0x7ffc3822a77f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\sys\backtrace.rs:168
   9:     0x7ffc3822cf7e - std::panicking::begin_panic_handler
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\panicking.rs:695
  10:     0x7ffc3b0fed41 - core::panicking::panic_fmt
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\core\src\panicking.rs:75
  11:     0x7ffc38199a51 - <rustc_errors[42171fc74e8af5b8]::DiagCtxtInner as core[991f9e90141a1bf]::ops::drop::Drop>::drop
  12:     0x7ffc35215040 - _rust_alloc_error_handler
  13:     0x7ffc3523956d - _rust_alloc_error_handler
  14:     0x7ffc35236ca6 - _rust_alloc_error_handler
  15:     0x7ffc35247492 - RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  16:     0x7ffc35240259 - RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs3zgY6wvIJ9S_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCslzhJIxFyRmJ_17rustc_driver_i
  17:     0x7ffc35253583 - RINvNtNtCsdilRq3JDxER_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs3tVoUkX7Cwz_5alloc5boxed3BoxDINtNtNtCsOWpfTZVyMJ_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECslzhJ
  18:     0x7ffc3823f6ad - alloc::boxed::impl$28::call_once
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2013
  19:     0x7ffc3823f6ad - alloc::boxed::impl$28::call_once
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\alloc\src\boxed.rs:2013
  20:     0x7ffc3823f6ad - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/649b995a9febd658b2570160703dff6fdc038ab2/library\std\src\sys\pal\windows\thread.rs:56
  21:     0x7ffc97117374 - BaseThreadInitThunk
  22:     0x7ffc9725cc91 - RtlUserThreadStart


rustc version: 1.86.0-nightly (649b995a9 2025-01-22)
platform: x86_64-pc-windows-msvc
```

</p>
</details>