https://gcc.gnu.org/g:2ce6c08f21a756c513b7ea7cb22a3c0067665790

commit 2ce6c08f21a756c513b7ea7cb22a3c0067665790
Author: jjasmine <tanghocle...@gmail.com>
Date:   Fri Jun 21 23:38:10 2024 -0700

    Add test case for using asm! outside of unsafe {}
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/inline_asm_outside_unsafe.rs: New test.

Diff:
---
 gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

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" }
+}
+

Reply via email to