-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-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) ❄️I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Description
snippet
//@compile-flags: -Zmir-enable-passes=+DataflowConstProp --crate-type lib --edition=2021
pub async fn a() -> u32 {
unsafe { std::mem::transmute(1usize) }
}original:
//@ edition:2018
// .gitattributes file in this directory should enforce it.
/// [https://bloob.blob]
pub async fn a() -> u32 { std::mem::transmute(1usize) }Version information
rustc 1.94.0-nightly (5b150d238 2025-12-11)
binary: rustc
commit-hash: 5b150d238fbd4fe7bc2cd3140d8e6fb4406099fa
commit-date: 2025-12-11
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.5
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zmir-enable-passes=+DataflowConstProp --crate-type lib --edition=2021
Program output
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> BC3F301FE4B2C0AC50F0C3F13FAF1D2AE4AD05443021AFF4CB58B5260D844868.rs:3:14
|
3 | unsafe { std::mem::transmute(1usize) }
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `usize` (64 bits)
= note: target type: `u32` (32 bits)
thread 'rustc' (1521152) panicked at /rustc-dev/c4dc70ee0ad7f811fb32e5bed9cd6c7b37beed4e/compiler/rustc_const_eval/src/interpret/operand.rs:123:17:
assertion `left == right` failed: invalid immediate for given destination place: scalar value has wrong size
left: Size(8 bytes)
right: Size(4 bytes)
stack backtrace:
0: 0x7f09c44c6133 - <<std[4ba5a76045f2e409]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f3ddf6de697c19ed]::fmt::Display>::fmt
1: 0x7f09c4c10608 - core[f3ddf6de697c19ed]::fmt::write
2: 0x7f09c44dc846 - <std[4ba5a76045f2e409]::sys::stdio::unix::Stderr as std[4ba5a76045f2e409]::io::Write>::write_fmt
3: 0x7f09c449c8f8 - std[4ba5a76045f2e409]::panicking::default_hook::{closure#0}
4: 0x7f09c44ba003 - std[4ba5a76045f2e409]::panicking::default_hook
5: 0x7f09c350a247 - std[4ba5a76045f2e409]::panicking::update_hook::<alloc[7f145662aca8c9c]::boxed::Box<rustc_driver_impl[6aae568bf99046c3]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f09c44ba2e2 - std[4ba5a76045f2e409]::panicking::panic_with_hook
7: 0x7f09c449c9b8 - std[4ba5a76045f2e409]::panicking::panic_handler::{closure#0}
8: 0x7f09c44911d9 - std[4ba5a76045f2e409]::sys::backtrace::__rust_end_short_backtrace::<std[4ba5a76045f2e409]::panicking::panic_handler::{closure#0}, !>
9: 0x7f09c449e56d - __rustc[4d7f59a3bb196642]::rust_begin_unwind
10: 0x7f09c10b853c - core[f3ddf6de697c19ed]::panicking::panic_fmt
11: 0x7f09c2f22503 - core[f3ddf6de697c19ed]::panicking::assert_failed_inner
12: 0x7f09c3abee2e - core[f3ddf6de697c19ed]::panicking::assert_failed::<rustc_abi[323bcc08463c2da1]::Size, rustc_abi[323bcc08463c2da1]::Size>
13: 0x7f09c6969ae1 - <rustc_const_eval[a6b790c01f68a297]::interpret::operand::Immediate>::assert_matches_abi::<rustc_const_eval[a6b790c01f68a297]::interpret::eval_context::InterpCx<rustc_const_eval[a6b790c01f68a297]::const_eval::dummy_machine::DummyMachine>>.cold
14: 0x7f09c57fcdfd - <rustc_const_eval[a6b790c01f68a297]::interpret::eval_context::InterpCx<rustc_const_eval[a6b790c01f68a297]::const_eval::dummy_machine::DummyMachine>>::write_immediate_to_mplace_no_validate
15: 0x7f09c57fcd5b - <rustc_const_eval[a6b790c01f68a297]::interpret::eval_context::InterpCx<rustc_const_eval[a6b790c01f68a297]::const_eval::dummy_machine::DummyMachine>>::write_immediate_no_validate::<rustc_const_eval[a6b790c01f68a297]::interpret::place::PlaceTy>
16: 0x7f09c3c82c97 - rustc_mir_transform[47693a1e9fa3d5e6]::dataflow_const_prop::try_write_constant
17: 0x7f09c3c82ec2 - rustc_mir_transform[47693a1e9fa3d5e6]::dataflow_const_prop::try_write_constant
18: 0x7f09c3c78062 - <rustc_mir_transform[47693a1e9fa3d5e6]::dataflow_const_prop::Collector>::try_make_constant
19: 0x7f09c3cee0b8 - <rustc_mir_transform[47693a1e9fa3d5e6]::dataflow_const_prop::Collector as rustc_mir_dataflow[db5e4e02463b2c0b]::framework::visitor::ResultsVisitor<rustc_mir_transform[47693a1e9fa3d5e6]::dataflow_const_prop::ConstAnalysis>>::visit_after_primary_statement_effect
20: 0x7f09c3c9e96a - <rustc_mir_transform[47693a1e9fa3d5e6]::dataflow_const_prop::DataflowConstProp as rustc_mir_transform[47693a1e9fa3d5e6]::pass_manager::MirPass>::run_pass
21: 0x7f09c4c073ba - rustc_mir_transform[47693a1e9fa3d5e6]::run_optimization_passes
22: 0x7f09c5a11152 - rustc_mir_transform[47693a1e9fa3d5e6]::optimized_mir
23: 0x7f09c5a10d6f - rustc_query_impl[23ea27e8a90d8b37]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[23ea27e8a90d8b37]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 8usize]>>
24: 0x7f09c4c18806 - rustc_query_system[2e8d7520d0881f27]::query::plumbing::try_execute_query::<rustc_query_impl[23ea27e8a90d8b37]::DynamicConfig<rustc_query_system[2e8d7520d0881f27]::query::caches::DefIdCache<rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[23ea27e8a90d8b37]::plumbing::QueryCtxt, false>
25: 0x7f09c4c17ddb - rustc_query_impl[23ea27e8a90d8b37]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
26: 0x7f09c5fb96c1 - <rustc_middle[21423b4d0c52388d]::ty::context::TyCtxt>::coroutine_layout
27: 0x7f09c554898f - rustc_ty_utils[1163db851dfce16c]::layout::layout_of_uncached
28: 0x7f09c5538bc9 - rustc_ty_utils[1163db851dfce16c]::layout::layout_of
29: 0x7f09c5538b2a - rustc_query_impl[23ea27e8a90d8b37]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[23ea27e8a90d8b37]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 16usize]>>
30: 0x7f09c55379e3 - rustc_query_system[2e8d7520d0881f27]::query::plumbing::try_execute_query::<rustc_query_impl[23ea27e8a90d8b37]::DynamicConfig<rustc_query_system[2e8d7520d0881f27]::query::caches::DefaultCache<rustc_middle[21423b4d0c52388d]::ty::PseudoCanonicalInput<rustc_middle[21423b4d0c52388d]::ty::Ty>, rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[23ea27e8a90d8b37]::plumbing::QueryCtxt, false>
31: 0x7f09c553761a - rustc_query_impl[23ea27e8a90d8b37]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
32: 0x7f09c5ce8a89 - <rustc_mir_transform[47693a1e9fa3d5e6]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[47693a1e9fa3d5e6]::pass_manager::MirLint>::run_lint
33: 0x7f09c4c0c59e - rustc_mir_transform[47693a1e9fa3d5e6]::run_analysis_to_runtime_passes
34: 0x7f09c5813000 - rustc_mir_transform[47693a1e9fa3d5e6]::mir_drops_elaborated_and_const_checked
35: 0x7f09c58129a9 - rustc_query_impl[23ea27e8a90d8b37]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[23ea27e8a90d8b37]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 8usize]>>
36: 0x7f09c4d9a637 - rustc_query_system[2e8d7520d0881f27]::query::plumbing::try_execute_query::<rustc_query_impl[23ea27e8a90d8b37]::DynamicConfig<rustc_data_structures[e7ed3fe572b1bf09]::vec_cache::VecCache<rustc_span[75d45f3c27fef647]::def_id::LocalDefId, rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[2e8d7520d0881f27]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[23ea27e8a90d8b37]::plumbing::QueryCtxt, false>
37: 0x7f09c4d99cc9 - rustc_query_impl[23ea27e8a90d8b37]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
38: 0x7f09c4d96fbf - <rustc_middle[21423b4d0c52388d]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[eefada1bb51de1fc]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
39: 0x7f09c4d946fa - rustc_interface[eefada1bb51de1fc]::passes::analysis
40: 0x7f09c4d93b91 - rustc_query_impl[23ea27e8a90d8b37]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[23ea27e8a90d8b37]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 0usize]>>
41: 0x7f09c5d80b20 - rustc_query_system[2e8d7520d0881f27]::query::plumbing::try_execute_query::<rustc_query_impl[23ea27e8a90d8b37]::DynamicConfig<rustc_query_system[2e8d7520d0881f27]::query::caches::SingleCache<rustc_middle[21423b4d0c52388d]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[23ea27e8a90d8b37]::plumbing::QueryCtxt, false>
42: 0x7f09c5d80776 - rustc_query_impl[23ea27e8a90d8b37]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
43: 0x7f09c5f14b13 - <rustc_interface[eefada1bb51de1fc]::passes::create_and_enter_global_ctxt<core[f3ddf6de697c19ed]::option::Option<rustc_interface[eefada1bb51de1fc]::queries::Linker>, rustc_driver_impl[6aae568bf99046c3]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[f3ddf6de697c19ed]::ops::function::FnOnce<(&rustc_session[b2db305ad29886f6]::session::Session, rustc_middle[21423b4d0c52388d]::ty::context::CurrentGcx, alloc[7f145662aca8c9c]::sync::Arc<rustc_data_structures[e7ed3fe572b1bf09]::jobserver::Proxy>, &std[4ba5a76045f2e409]::sync::once_lock::OnceLock<rustc_middle[21423b4d0c52388d]::ty::context::GlobalCtxt>, &rustc_data_structures[e7ed3fe572b1bf09]::sync::worker_local::WorkerLocal<rustc_middle[21423b4d0c52388d]::arena::Arena>, &rustc_data_structures[e7ed3fe572b1bf09]::sync::worker_local::WorkerLocal<rustc_hir[96c42a8d71e5a9b1]::Arena>, rustc_driver_impl[6aae568bf99046c3]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
44: 0x7f09c5de1205 - rustc_interface[eefada1bb51de1fc]::interface::run_compiler::<(), rustc_driver_impl[6aae568bf99046c3]::run_compiler::{closure#0}>::{closure#1}
45: 0x7f09c5d36b0a - std[4ba5a76045f2e409]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[eefada1bb51de1fc]::util::run_in_thread_with_globals<rustc_interface[eefada1bb51de1fc]::util::run_in_thread_pool_with_globals<rustc_interface[eefada1bb51de1fc]::interface::run_compiler<(), rustc_driver_impl[6aae568bf99046c3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
46: 0x7f09c5d368dd - <std[4ba5a76045f2e409]::thread::lifecycle::spawn_unchecked<rustc_interface[eefada1bb51de1fc]::util::run_in_thread_with_globals<rustc_interface[eefada1bb51de1fc]::util::run_in_thread_pool_with_globals<rustc_interface[eefada1bb51de1fc]::interface::run_compiler<(), rustc_driver_impl[6aae568bf99046c3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f3ddf6de697c19ed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
47: 0x7f09c5d34cb8 - <std[4ba5a76045f2e409]::sys::thread::unix::Thread>::new::thread_start
48: 0x7f09bf6969cb - <unknown>
49: 0x7f09bf71aa0c - <unknown>
50: 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 `/tmp/im/rustc-ice-2025-12-12T15_23_24-1521150.txt` to your bug report
note: compiler flags: -Z mir-enable-passes=+DataflowConstProp --crate-type lib
query stack during panic:
#0 [optimized_mir] optimizing MIR for `a::{closure#0}`
#1 [layout_of] computing layout of `{async fn body of a()}`
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `a`
#3 [analysis] running analysis passes on crate `BC3F301FE4B2C0AC50F0C3F13FAF1D2AE4AD05443021AFF4CB58B5260D844868`
end of query stack
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0512`.
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-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) ❄️I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.