Quoting from tests/ui/asm/const-refs-to-static.rs @ 31e102c
I tried this code:
use std::arch::{asm, global_asm};
use std::ptr::addr_of;
static FOO: u8 = 42;
#[no_mangle]
fn inline() {
unsafe { asm!("{}", const addr_of!(FOO)) };
}
I expected to see this happen: it should compiles
Instead, this happened: *const u8 is not allowed as an operand to inline assembly.
This would be coming useful and brings us feature-parity with asm(" /* assembly */ " ::"i"(ptr)) from C, where ptr can be pointer to statics and constants.
cc @Amanieu @nbdd0121
Meta
rustc --version --verbose:
Backtrace
Quoting from
tests/ui/asm/const-refs-to-static.rs@ 31e102cI tried this code:
I expected to see this happen: it should compiles
Instead, this happened:
*const u8is not allowed as an operand to inline assembly.This would be coming useful and brings us feature-parity with
asm(" /* assembly */ " ::"i"(ptr))from C, whereptrcan be pointer to statics and constants.cc @Amanieu @nbdd0121
Meta
rustc --version --verbose:Backtrace