about summary refs log tree commit diff
path: root/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs')
-rw-r--r--tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs
index 34e5a6b96e3..4bbf9b25de5 100644
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs
@@ -40,6 +40,15 @@ macro_rules! meta2 {
     }
 }
 
+macro_rules! with_cfg_attr {
+    () => {
+        #[cfg_attr(all(), link_section = ".custom_section")]
+        //~^ ERROR: unsafe attribute used without unsafe
+        //~| WARN this is accepted in the current edition
+        pub extern "C" fn abc() {}
+    };
+}
+
 tt!([no_mangle]);
 //~^ ERROR: unsafe attribute used without unsafe
 //~| WARN this is accepted in the current edition
@@ -52,6 +61,8 @@ meta2!(export_name = "baw");
 //~| WARN this is accepted in the current edition
 ident2!(export_name, "bars");
 
+with_cfg_attr!();
+
 #[no_mangle]
 //~^ ERROR: unsafe attribute used without unsafe
 //~| WARN this is accepted in the current edition