-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed as duplicate of#138979
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Compiling heapless = "0.9.1"
in release mode appears to cause a panic.
cargo init foo
cargo add heapless
cargo build --release
cargo build
passes ok.
Code
$ cat Cargo.toml
[package]
name = "foo"
version = "0.1.0"
edition = "2024"
[dependencies]
heapless = "0.9.1"
Meta
rustc --version --verbose
:
$ rustc --version --verbose
rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-unknown-linux-gnu
release: 1.86.0
LLVM version: 19.1.7
Error output
<output>
Backtrace
$ RUST_BACKTRACE=1 cargo build --release
Compiling heapless v0.9.1
thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:675: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::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_rvalue
15: rustc_mir_transform::validate::validate_types
16: rustc_mir_transform::inline::process_blocks::<rustc_mir_transform::inline::NormalInliner>
17: <rustc_mir_transform::inline::Inline as rustc_mir_transform::pass_manager::MirPass>::run_pass
18: rustc_mir_transform::pass_manager::run_passes_inner
19: rustc_mir_transform::optimized_mir
20: 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]>>
21: 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>
22: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
23: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>>
24: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
25: rustc_metadata::rmeta::encoder::encode_metadata
26: rustc_metadata::fs::encode_and_write_metadata
27: <rustc_interface::queries::Linker>::codegen_and_build_linker
28: 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}
29: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
30: 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}, ()>
31: <<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}
32: std::sys::pal::unix::thread::Thread::new::thread_start
33: start_thread
at ./nptl/pthread_create.c:447:8
34: clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
stack backtrace:
0: 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: rustc 1.86.0 (05f9846f8 2025-03-31) running on x86_64-unknown-linux-gnu
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: `/home/er20605/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name heapless --edition=2021 /home/er20605/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/heapless-0.9.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=150 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "bytes", "defmt", "mpmc_large", "nightly", "portable-atomic", "portable-atomic-critical-section", "portable-atomic-unsafe-assume-single-core", "serde", "ufmt"))' -C metadata=94ed9d3818aa8e1a -C extra-filename=-e886d5429ec38968 --out-dir /home/er20605/tmp/foo/target/release/deps -C strip=debuginfo -L dependency=/home/er20605/tmp/foo/target/release/deps --extern hash32=/home/er20605/tmp/foo/target/release/deps/libhash32-dac718cb5492bd62.rmeta --extern stable_deref_trait=/home/er20605/tmp/foo/target/release/deps/libstable_deref_trait-61e4df8b11014761.rmeta --cap-lints allow --check-cfg 'cfg(arm_llsc)' --check-cfg 'cfg(has_atomic_load_store)'` (exit status: 101)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.