Closed
Description
When trying to use the new asm!
syntax to implement something similar to std::hint::black_box
, it fails with an "argument never used" error. For example (https://godbolt.org/z/mG9AMg):
#![feature(asm)]
pub fn black_box(dummy: i32) -> i32 {
unsafe {
asm!("", in(reg) &dummy, options(nostack));
dummy
}
}
error: argument never used
--> <source>:5:18
|
5 | asm!("", in(reg) &dummy, options(nostack));
| ^^^^^^^^^^^^^^ argument never used
error: aborting due to previous error
Compiler returned: 1
This makes it impossible to use the new asm!
syntax in one of my crates (cesarb/clear_on_drop@43cd2be with CI output at https://travis-ci.org/github/cesarb/clear_on_drop/jobs/694467164).