rust/tests/ui/asm/conditionally-sized-ptr-fail.rs
2025-02-24 16:20:50 +00:00

19 lines
408 B
Rust

//@ needs-asm-support
use std::arch::asm;
fn _f<T: ?Sized>(p: *mut T) {
unsafe {
asm!("/* {} */", in(reg) p);
//~^ ERROR cannot use value of unsized pointer type `*mut T` for inline assembly
}
}
fn _g(p: *mut [u8]) {
unsafe {
asm!("/* {} */", in(reg) p);
//~^ ERROR cannot use value of unsized pointer type `*mut [u8]` for inline assembly
}
}
fn main() {}