Repository: rust
Issue: ICE: `trimmed_def_paths` called, diagnostics were expected but none were emitted
Labels: A-diagnostics,I-ICE,T-compiler,C-bug,WG-diagnostics,A-patterns,S-has-mcve

beta triggered an ICE in Quinn's CI today:

https://github.com/quinn-rs/quinn/actions/runs/12691355015/job/35374229601?pr=2130

Maybe similar/related to:

-  #134345

Maybe a fix that could be backported?

```
thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:646: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:     0x7fc24a2de3ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4877db58cd1f68da
   1:     0x7fc24aa135e6 - core::fmt::write::ha314f3a66d347c48
   2:     0x7fc24b903a11 - std::io::Write::write_fmt::h50f19c6ac271d942
   3:     0x7fc24a2de212 - std::sys::backtrace::BacktraceLock::print::hf8fc8e4f6df76466
   4:     0x7fc24a2e07b7 - std::panicking::default_hook::{{closure}}::hc1cbccbc75363945
   5:     0x7fc24a2e05a0 - std::panicking::default_hook::ha6ac61b9282038d9
   6:     0x7fc249453168 - std[a5195d1e2fc22c41]::panicking::update_hook::<alloc[20639d31ccb56773]::boxed::Box<rustc_driver_impl[5024ff76ded81fa1]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fc24a2e1003 - std::panicking::rust_panic_with_hook::h5663cbee266e1761
   8:     0x7fc24a2e0cfa - std::panicking::begin_panic_handler::{{closure}}::hbbe6da1959d575ac
   9:     0x7fc24a2de889 - std::sys::backtrace::__rust_end_short_backtrace::h8c70aabd292ca3dd
  10:     0x7fc24a2e09bd - rust_begin_unwind
  11:     0x7fc246f9ff80 - core::panicking::panic_fmt::h044f8a6ac8b759ab
  12:     0x7fc24b850471 - <rustc_errors[697e64861a5c752e]::DiagCtxtInner as core[355654ca938a17d7]::ops::drop::Drop>::drop
  13:     0x7fc24b850f9c - core[355654ca938a17d7]::ptr::drop_in_place::<rustc_errors[697e64861a5c752e]::DiagCtxt>
  14:     0x7fc24b9a551a - core[355654ca938a17d7]::ptr::drop_in_place::<rustc_session[7408041faf332997]::parse::ParseSess>
  15:     0x7fc24b9a64a0 - core[355654ca938a17d7]::ptr::drop_in_place::<rustc_interface[2b78e7c3f7f2a3ff]::interface::Compiler>
  16:     0x7fc24b9ada79 - rustc_interface[2b78e7c3f7f2a3ff]::interface::run_compiler::<(), rustc_driver_impl[5024ff76ded81fa1]::run_compiler::{closure#0}>::{closure#1}
  17:     0x7fc24b853b95 - std[a5195d1e2fc22c41]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_pool_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::interface::run_compiler<(), rustc_driver_impl[5024ff76ded81fa1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  18:     0x7fc24b854048 - <<std[a5195d1e2fc22c41]::thread::Builder>::spawn_unchecked_<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_pool_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::interface::run_compiler<(), rustc_driver_impl[5024ff76ded81fa1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[355654ca938a17d7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  19:     0x7fc24b855601 - std::sys::pal::unix::thread::Thread::new::thread_start::h535af24502242ac5
  20:     0x7fc245a9ca94 - <unknown>
  21:     0x7fc245b29c3c - <unknown>
  22:                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: rustc 1.85.0-beta.1 (e30eefff4 2025-01-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `quinn-proto` (lib test)

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/rustc --crate-name quinn_proto --edition=2021 quinn-proto/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --warn=unexpected_cfgs --check-cfg 'cfg(fuzzing)' --test --cfg 'feature="default"' --cfg 'feature="log"' --cfg 'feature="platform-verifier"' --cfg 'feature="ring"' --cfg 'feature="rustls-ring"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("arbitrary", "aws-lc-rs", "aws-lc-rs-fips", "default", "log", "platform-verifier", "ring", "rustls", "rustls-aws-lc-rs", "rustls-aws-lc-rs-fips", "rustls-log", "rustls-ring"))' -C metadata=e4cd9ebb7814c565 -C extra-filename=-875e02898ea8dd6b --out-dir /home/runner/work/quinn/quinn/target/debug/deps -L dependency=/home/runner/work/quinn/quinn/target/debug/deps --extern assert_matches=/home/runner/work/quinn/quinn/target/debug/deps/libassert_matches-ff215179dd669654.rlib --extern bytes=/home/runner/work/quinn/quinn/target/debug/deps/libbytes-a85ea1e0de84b215.rlib --extern hex_literal=/home/runner/work/quinn/quinn/target/debug/deps/libhex_literal-26f17529c9d73dcc.rlib --extern lazy_static=/home/runner/work/quinn/quinn/target/debug/deps/liblazy_static-b03541b63c18dba7.rlib --extern rand=/home/runner/work/quinn/quinn/target/debug/deps/librand-717c8c34580787c0.rlib --extern rcgen=/home/runner/work/quinn/quinn/target/debug/deps/librcgen-86629bfa01ffb0b4.rlib --extern ring=/home/runner/work/quinn/quinn/target/debug/deps/libring-b326a68ecfa48aef.rlib --extern rustc_hash=/home/runner/work/quinn/quinn/target/debug/deps/librustc_hash-311bd3609ea046c6.rlib --extern rustls=/home/runner/work/quinn/quinn/target/debug/deps/librustls-df6c75c11fb1ff22.rlib --extern rustls_platform_verifier=/home/runner/work/quinn/quinn/target/debug/deps/librustls_platform_verifier-11787e01b1085472.rlib --extern slab=/home/runner/work/quinn/quinn/target/debug/deps/libslab-3c03d7cf5b378de6.rlib --extern thiserror=/home/runner/work/quinn/quinn/target/debug/deps/libthiserror-efb27899156c3206.rlib --extern tinyvec=/home/runner/work/quinn/quinn/target/debug/deps/libtinyvec-1f34b1656bcd04e6.rlib --extern tracing=/home/runner/work/quinn/quinn/target/debug/deps/libtracing-908c8b1357dbbdf0.rlib --extern tracing_subscriber=/home/runner/work/quinn/quinn/target/debug/deps/libtracing_subscriber-d313c5fd47fc560a.rlib --extern wasm_bindgen_test=/home/runner/work/quinn/quinn/target/debug/deps/libwasm_bindgen_test-35a5da5beb78a7c9.rlib -L native=/home/runner/work/quinn/quinn/target/debug/build/ring-f079ed4dd15e693d/out` (exit status: 101)
```