Closed
Description
Minimized from a program @jfro was trying to debug.
I tried this code:
fn main() {
for (i, _) in [0u8].iter().enumerate() {
let test = i as f32;
println!("i: {}", test);
let _wtf = i as u32;
}
}
I expected to see this happen:
i: 0
Instead, this happened:
i: 536870900
Meta
I see this on aarch64 and not on x86_64. I don't have access to any other architectures. Output is as expected with --release
. I can also observe this bug on the previous stable (1.56.1), current beta (1.58.0-beta.3) and current nightly (89b9f7b 2022-01-10).
rustc --version --verbose
:
rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: aarch64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0