I tried this code:
pub enum E {
A = -2,
B,
}
const _: [(); 1] = [(); -(E::B as i8) as usize];
I expected to see this happen: E::B is documented as taking the value -1.
Instead, this happened:
Meta
rustc --version --verbose:
rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: x86_64-unknown-linux-gnu
release: 1.89.0
LLVM version: 20.1.7
Also happens on Nightly:
rustc 1.91.0-nightly (7d82b83ed 2025-08-06)
binary: rustc
commit-hash: 7d82b83ed57d188ab3f2441a765a6419685a88a3
commit-date: 2025-08-06
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
I tried this code:
I expected to see this happen:
E::Bis documented as taking the value-1.Instead, this happened:
Meta
rustc --version --verbose:Also happens on Nightly: