From 2ce6c08f21a756c513b7ea7cb22a3c0067665790 Mon Sep 17 00:00:00 2001 From: jjasmine Date: Fri, 21 Jun 2024 23:38:10 -0700 Subject: [PATCH] Add test case for using asm! outside of unsafe {} gcc/testsuite/ChangeLog: * rust/compile/inline_asm_outside_unsafe.rs: New test. --- .../rust/compile/inline_asm_outside_unsafe.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs 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 000000000000..02b9ab0c393e --- /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" } +} +