about summary refs log tree commit diff
path: root/tests/ui/asm/naked-invalid-attr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/asm/naked-invalid-attr.rs')
-rw-r--r--tests/ui/asm/naked-invalid-attr.rs39
1 files changed, 24 insertions, 15 deletions
diff --git a/tests/ui/asm/naked-invalid-attr.rs b/tests/ui/asm/naked-invalid-attr.rs
index 4053c58fb51..6ac9cb9e3a9 100644
--- a/tests/ui/asm/naked-invalid-attr.rs
+++ b/tests/ui/asm/naked-invalid-attr.rs
@@ -1,53 +1,62 @@
-// Checks that #[naked] attribute can be placed on function definitions only.
+// Checks that the #[unsafe(naked)] attribute can be placed on function definitions only.
 //
 //@ needs-asm-support
-#![feature(naked_functions)]
-#![naked] //~ ERROR should be applied to a function definition
+#![unsafe(naked)] //~ ERROR should be applied to a function definition
 
 use std::arch::naked_asm;
 
 extern "C" {
-    #[naked] //~ ERROR should be applied to a function definition
+    #[unsafe(naked)] //~ ERROR should be applied to a function definition
     fn f();
 }
 
-#[naked] //~ ERROR should be applied to a function definition
+#[unsafe(naked)] //~ ERROR should be applied to a function definition
 #[repr(C)]
 struct S {
+    #[unsafe(naked)] //~ ERROR should be applied to a function definition
     a: u32,
     b: u32,
 }
 
 trait Invoke {
-    #[naked] //~ ERROR should be applied to a function definition
+    #[unsafe(naked)] //~ ERROR should be applied to a function definition
     extern "C" fn invoke(&self);
 }
 
 impl Invoke for S {
-    #[naked]
+    #[unsafe(naked)]
     extern "C" fn invoke(&self) {
-        unsafe { naked_asm!("") }
+        naked_asm!("")
     }
 }
 
-#[naked]
+#[unsafe(naked)]
 extern "C" fn ok() {
-    unsafe { naked_asm!("") }
+    naked_asm!("")
 }
 
 impl S {
-    #[naked]
+    #[unsafe(naked)]
     extern "C" fn g() {
-        unsafe { naked_asm!("") }
+        naked_asm!("")
     }
 
-    #[naked]
+    #[unsafe(naked)]
     extern "C" fn h(&self) {
-        unsafe { naked_asm!("") }
+        naked_asm!("")
     }
 }
 
 fn main() {
-    #[naked] //~ ERROR should be applied to a function definition
+    #[unsafe(naked)] //~ ERROR should be applied to a function definition
     || {};
 }
+
+// Check that the path of an attribute without a name is printed correctly (issue #140082)
+#[::a]
+//~^ ERROR attribute incompatible with `#[unsafe(naked)]`
+//~| ERROR failed to resolve: use of unresolved module or unlinked crate `a`
+#[unsafe(naked)]
+extern "C" fn issue_140082() {
+    naked_asm!("")
+}