Closed
Description
Code
The error shows up on a heapless
PR: https://github.com/rust-embedded/heapless/actions/runs/14080602762/job/39432486570
Meta
The error reproduces on the latest nightly.
rustc --version --verbose
:
rustc 1.87.0-nightly (43f0014ef 2025-03-25)
binary: rustc
commit-hash: 43f0014ef0f242418674f49052ed39b70f73bc1c
commit-date: 2025-03-25
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.1
Error output
thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:702: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:
The file Rustc tells me to include in the report: rustc-ice-2025-03-26T10_16_27-247085.txt
Backtrace
$ RUST_BACKTRACE=1 cargo +nightly test --test cpass --target=x86_64-unknown-linux-gnu --features=serde --release
Compiling heapless v0.8.0 (/path/to/heapless)
Compiling ufmt-macros v0.3.0
Compiling ufmt v0.2.0
thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:702: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: <rustc_errors::DiagCtxtHandle>::set_must_produce_diag
1: <rustc_session::session::Session>::record_trimmed_def_paths
2: rustc_middle::ty::print::pretty::trimmed_def_paths
3: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::trimmed_def_paths::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
4: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
5: rustc_query_impl::query_impl::trimmed_def_paths::get_query_non_incr::__rust_end_short_backtrace
6: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
7: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
8: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::pretty::PrettyPrinter>::pretty_print_type
9: <rustc_type_ir::ty_kind::TypeAndMut<rustc_middle::ty::context::TyCtxt> as rustc_middle::ty::print::Print<rustc_middle::ty::print::pretty::FmtPrinter>>::print
10: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::pretty::PrettyPrinter>::pretty_print_type
11: <rustc_middle::ty::Ty as core::fmt::Display>::fmt
12: core::fmt::write
13: alloc::fmt::format::format_inner
14: rustc_mir_transform::validate::validate_types
15: rustc_mir_transform::inline::process_blocks::<rustc_mir_transform::inline::NormalInliner>
16: <rustc_mir_transform::inline::Inline as rustc_mir_transform::pass_manager::MirPass>::run_pass
17: rustc_mir_transform::pass_manager::run_passes_inner
18: rustc_mir_transform::optimized_mir
19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
21: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
22: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
23: rustc_metadata::rmeta::encoder::encode_metadata
24: rustc_metadata::fs::encode_and_write_metadata
25: <rustc_interface::queries::Linker>::codegen_and_build_linker
26: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
27: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
28: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
29: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
30: std::sys::pal::unix::thread::Thread::new::thread_start
31: <unknown>
32: <unknown>
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <rustc_errors::DiagCtxtInner as core::ops::drop::Drop>::drop
3: core::ptr::drop_in_place::<rustc_errors::DiagCtxt>
4: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
5: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
6: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: please make sure that you have updated to the latest nightly
note: please attach the file at `//heapless/rustc-ice-2025-03-26T10_16_27-247085.txt` to your bug report
note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `heapless` (lib)
Caused by:
process didn't exit successfully: `/path/to/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name heapless --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=118 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="serde"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("defmt-03", "mpmc_large", "nightly", "portable-atomic", "portable-atomic-critical-section", "portable-atomic-unsafe-assume-single-core", "serde", "ufmt"))' -C metadata=6044f4ee7b749481 -C extra-filename=-f464495b68b6a9ee --out-dir /path/to/heapless/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C strip=debuginfo -L dependency=/path/to/heapless/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/path/to/heapless/target/release/deps --extern hash32=/path/to/heapless/target/x86_64-unknown-linux-gnu/release/deps/libhash32-3e9b94b42a8a0b01.rmeta --extern serde=/path/to/heapless/target/x86_64-unknown-linux-gnu/release/deps/libserde-66dbe2816a197a10.rmeta --extern stable_deref_trait=/path/to/heapless/target/x86_64-unknown-linux-gnu/release/deps/libstable_deref_trait-2c16bd63df11f843.rmeta --check-cfg 'cfg(arm_llsc)' --check-cfg 'cfg(has_atomic_load_store)'` (exit status: 101)
I saw #135673, which seems to be the same issue, but should be fixed (at least in the latest nightly), but as tested on nightly it fails.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.