[ICE]: Mixing embedded targets and toolchains
Open
Nobody has claimed this yet.
C-bug
I-ICE
needs-triage
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
This error occurred during the beginning stages of testing for an embedded project
(Note: This panic is caused by user error, as the mix between avr and esp targets is nonsensical)
Code
Cargo.toml:
[dependencies]
panic-halt = "1.0.0"
embedded-hal = "1.0"
[dependencies.arduino-hal]
git = "https://github.com/rahix/avr-hal"
features = ["arduino-uno"]
# Configure the build for minimal size - AVRs have very little program memory
[profile.dev]
panic = "abort"
lto = true
opt-level = "s"
debug = true
[profile.release]
panic = "abort"
lto = true
opt-level = "s"
codegen-units = 1
[lib]
crate-type = ["staticlib"]
rust-toolchain.toml:
[toolchain]
components = ["rust-src"]
profile = "minimal"
channel = "esp"
src/lib.rs:
#![no_std]
#![no_main]
use panic_halt as _;
#[unsafe(no_mangle)]
pub extern "C" fn one_thousand() -> core::ffi::c_int {
1000
}
Meta
rustc --version --verbose:
rustc 1.95.0-nightly (95e5bda86 2026-04-15) (1.95.0.0) running on x86_64-unknown-linux-gnu
Compiler flags:
-C target-cpu=atmega328p --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro
Error output
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/home/iris/.local/share/rustup/toolchains/esp/bin/rustc - --crate-name ___ --print=file-names -C target-cpu=atmega328p --target avr-none --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print
=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 101)
--- stderr
error: internal compiler error: the following error was constructed but not emitted
error: could not create LLVM TargetMachine for triple: avr-unknown-unknown
thread 'rustc' (34021) panicked at /rustc-dev/95e5bda868c960c607597bc03ed9e8f0ad26226d/compiler/rustc_errors/src/diagnostic.rs:1374:17:
error was constructed but not emitted
stack backtrace:
0: 0x727a267841b2 - <<std[a3add4dce74c2c5b]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[9e5d1e7ce392b9f7]::fmt::Display>::fmt
1: 0x727a267c676a - core[9e5d1e7ce392b9f7]::fmt::write
2: 0x727a26796b16 - <std[a3add4dce74c2c5b]::sys::stdio::unix::Stderr as std[a3add4dce74c2c5b]::io::Write>::write_fmt
3: 0x727a26752c0f - std[a3add4dce74c2c5b]::panicking::default_hook::{closure#0}
4: 0x727a26775f81 - std[a3add4dce74c2c5b]::panicking::default_hook
5: 0x727a1e38f6e4 - <alloc[2faf6a8366d6d1e8]::boxed::Box<rustc_driver_impl[64d3e312f7283923]::install_ice_hook::{closure#1}> as core[9e5d1e7ce392b9f7]::ops::function::Fn<(&dyn for<'a, 'b> core[9e5d1e7ce392b9f7]::ops::function::Fn<(&'a std[a3add4dce74c2c5b]::panic::PanicHookInfo<'b>,), Output = ()> + core[9e5d1e7ce392b9f7]::marker::Sync + core[9e5d1e7ce392b9f7]::marker::Send, &std[a3add4dce74c2c5b]::panic::PanicHookInfo)>>::call
6: 0x727a26776232 - std[a3add4dce74c2c5b]::panicking::panic_with_hook
7: 0x727a26752cfa - std[a3add4dce74c2c5b]::panicking::panic_handler::{closure#0}
8: 0x727a26746cf9 - std[a3add4dce74c2c5b]::sys::backtrace::__rust_end_short_backtrace::<std[a3add4dce74c2c5b]::panicking::panic_handler::{closure#0}, !>
9: 0x727a267544ed - __rustc[6601e34be1ba6884]::rust_begin_unwind
10: 0x727a267c71ac - core[9e5d1e7ce392b9f7]::panicking::panic_fmt
11: 0x727a1e725db1 - core[9e5d1e7ce392b9f7]::ptr::drop_in_place::<rustc_errors[efd70cac231e855f]::diagnostic::Diag>
12: 0x727a1e72d29e - <rustc_codegen_llvm[8999c950c2dccfdc]::errors::ParseTargetMachineConfig as rustc_errors[efd70cac231e855f]::diagnostic::Diagnostic<rustc_errors[efd70cac231e855f]::diagnostic::FatalAbort>>::into_diag
13: 0x727a1e712da6 - rustc_codegen_llvm[8999c950c2dccfdc]::back::write::target_machine_factory::{closure#0}
14: 0x727a1e719c1e - rustc_codegen_llvm[8999c950c2dccfdc]::back::write::create_informational_target_machine
15: 0x727a1e7f58a4 - rustc_codegen_llvm[8999c950c2dccfdc]::llvm_util::target_config
16: 0x727a1e71fcbc - <rustc_codegen_llvm[8999c950c2dccfdc]::LlvmCodegenBackend as rustc_codegen_ssa[175a57d11e85d80b]::traits::backend::CodegenBackend>::target_config
17: 0x727a1e55cb99 - rustc_interface[388e2ffddb5d4f02]::util::add_configuration
18: 0x727a1e35d56b - rustc_interface[388e2ffddb5d4f02]::interface::run_compiler::<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}
19: 0x727a1e35209a - rustc_span[c1c8228208c81aba]::create_session_globals_then::<(), rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_with_globals<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_pool_with_globals<rustc_interface[388e2ffddb5d4f02]::interface::run_compiler<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
20: 0x727a1e381805 - std[a3add4dce74c2c5b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_with_globals<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_pool_with_globals<rustc_interface[388e2ffddb5d4f02]::interface::run_compiler<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
21: 0x727a1e332d06 - <std[a3add4dce74c2c5b]::thread::lifecycle::spawn_unchecked<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_with_globals<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_pool_with_globals<rustc_interface[388e2ffddb5d4f02]::interface::run_compiler<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[9e5d1e7ce392b9f7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
22: 0x727a2678176f - <std[a3add4dce74c2c5b]::sys::thread::unix::Thread>::new::thread_start
23: 0x727a194a597a - <unknown>
24: 0x727a195292bc - <unknown>
25: 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: please make sure that you have updated to the latest nightly
note: please attach the file at `/home/iris/proj/paperbox/rust-code/rustc-ice-2026-05-17T04_15_34-34019.txt` to your bug report
note: rustc 1.95.0-nightly (95e5bda86 2026-04-15) (1.95.0.0) running on x86_64-unknown-linux-gnu
note: compiler flags: -C target-cpu=atmega328p --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro
query stack during panic:
end of query stack
Backtrace
stack backtrace:
0: 0x727a267841b2 - <<std[a3add4dce74c2c5b]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[9e5d1e7ce392b9f7]::fmt::Display>::fmt
1: 0x727a267c676a - core[9e5d1e7ce392b9f7]::fmt::write
2: 0x727a26796b16 - <std[a3add4dce74c2c5b]::sys::stdio::unix::Stderr as std[a3add4dce74c2c5b]::io::Write>::write_fmt
3: 0x727a26752c0f - std[a3add4dce74c2c5b]::panicking::default_hook::{closure#0}
4: 0x727a26775f81 - std[a3add4dce74c2c5b]::panicking::default_hook
5: 0x727a1e38f6e4 - <alloc[2faf6a8366d6d1e8]::boxed::Box<rustc_driver_impl[64d3e312f7283923]::install_ice_hook::{closure#1}> as core[9e5d1e7ce392b9f7]::ops::function::Fn<(&dyn for<'a, 'b> core[9e5d1e7ce392b9f7]::ops::function::Fn<(&'a std[a3add4dce74c2c5b]::panic::PanicHookInfo<'b>,), Output = ()> + core[9e5d1e7ce392b9f7]::marker::Sync + core[9e5d1e7ce392b9f7]::marker::Send, &std[a3add4dce74c2c5b]::panic::PanicHookInfo)>>::call
6: 0x727a26776232 - std[a3add4dce74c2c5b]::panicking::panic_with_hook
7: 0x727a26752cfa - std[a3add4dce74c2c5b]::panicking::panic_handler::{closure#0}
8: 0x727a26746cf9 - std[a3add4dce74c2c5b]::sys::backtrace::__rust_end_short_backtrace::<std[a3add4dce74c2c5b]::panicking::panic_handler::{closure#0}, !>
9: 0x727a267544ed - __rustc[6601e34be1ba6884]::rust_begin_unwind
10: 0x727a267c71ac - core[9e5d1e7ce392b9f7]::panicking::panic_fmt
11: 0x727a1e725db1 - core[9e5d1e7ce392b9f7]::ptr::drop_in_place::<rustc_errors[efd70cac231e855f]::diagnostic::Diag>
12: 0x727a1e72d29e - <rustc_codegen_llvm[8999c950c2dccfdc]::errors::ParseTargetMachineConfig as rustc_errors[efd70cac231e855f]::diagnostic::Diagnostic<rustc_errors[efd70cac231e855f]::diagnostic::FatalAbort>>::into_diag
13: 0x727a1e712da6 - rustc_codegen_llvm[8999c950c2dccfdc]::back::write::target_machine_factory::{closure#0}
14: 0x727a1e719c1e - rustc_codegen_llvm[8999c950c2dccfdc]::back::write::create_informational_target_machine
15: 0x727a1e7f58a4 - rustc_codegen_llvm[8999c950c2dccfdc]::llvm_util::target_config
16: 0x727a1e71fcbc - <rustc_codegen_llvm[8999c950c2dccfdc]::LlvmCodegenBackend as rustc_codegen_ssa[175a57d11e85d80b]::traits::backend::CodegenBackend>::target_config
17: 0x727a1e55cb99 - rustc_interface[388e2ffddb5d4f02]::util::add_configuration
18: 0x727a1e35d56b - rustc_interface[388e2ffddb5d4f02]::interface::run_compiler::<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}
19: 0x727a1e35209a - rustc_span[c1c8228208c81aba]::create_session_globals_then::<(), rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_with_globals<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_pool_with_globals<rustc_interface[388e2ffddb5d4f02]::interface::run_compiler<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
20: 0x727a1e381805 - std[a3add4dce74c2c5b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_with_globals<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_pool_with_globals<rustc_interface[388e2ffddb5d4f02]::interface::run_compiler<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
21: 0x727a1e332d06 - <std[a3add4dce74c2c5b]::thread::lifecycle::spawn_unchecked<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_with_globals<rustc_interface[388e2ffddb5d4f02]::util::run_in_thread_pool_with_globals<rustc_interface[388e2ffddb5d4f02]::interface::run_compiler<(), rustc_driver_impl[64d3e312f7283923]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[9e5d1e7ce392b9f7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
22: 0x727a2678176f - <std[a3add4dce74c2c5b]::sys::thread::unix::Thread>::new::thread_start
23: 0x727a194a597a - <unknown>
24: 0x727a195292bc - <unknown>
25: 0x0 - <unknown>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure from Cargo.toml, rust-toolchain.toml, and src/lib.rs using the shown avr target, esp toolchain, and compiler flags. Start with the reported rustc LLVM target configuration and diagnostic path; done means the mixed-target invocation no longer produces an internal compiler error and instead reports an appropriate error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100