From: jjasmine Date: Sat, 22 Jun 2024 06:38:10 +0000 (-0700) Subject: gccrs: Add test case for using asm! outside of unsafe {} X-Git-Tag: basepoints/gcc-16~1344 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10ba2fdca79c949c3be8acaab73a2fe6ddccc57b;p=thirdparty%2Fgcc.git gccrs: Add test case for using asm! outside of unsafe {} gcc/testsuite/ChangeLog: * rust/compile/inline_asm_outside_unsafe.rs: New test. --- diff --git a/gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs b/gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs new file mode 100644 index 00000000000..02b9ab0c393 --- /dev/null +++ b/gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs @@ -0,0 +1,11 @@ +#![feature(rustc_attrs)] + +#[rustc_builtin_macro] +macro_rules! asm { + () => {} +} + +fn main() { + asm!("nop"); // { dg-error "use of inline assembly is unsafe and requires unsafe function or block" } +} +