The code below used to build just fine back in April (Rust version ~1.6), but it doesn't anymore.
#![feature(asm)]
enum MyEnum { One = 1 }
fn main() {
unsafe {
asm!("nop" : : "i" (MyEnum::One as isize) : : ); // broken
}
}
The error message does not point to any obvious changes that might be causing this.
The value for the
"i"
constraint must be a compile-time constant and you are supplying it something that isn't. If you move the addition into Rust, you could use a register as well as a constant using the constraints"ri"
.Whether something is a constant for the purpose of inline assembler can be affected by optimization options.