about summary refs log tree commit diff
path: root/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-22 14:46:41 +0000
committerbors <bors@rust-lang.org>2025-01-22 14:46:41 +0000
commitdee7d0e730a3a3ed98c89dd33c4ac16edc82de8a (patch)
tree3d6e80304bba9a0899e5ecb00f8a378c72514c68 /tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed
parentb2728d5426bab1d8c39709768c7e22b7f66dde5d (diff)
parent2de21ad7d4a14894463816ac5dedc337ae3a2941 (diff)
downloadrust-dee7d0e730a3a3ed98c89dd33c4ac16edc82de8a.tar.gz
rust-dee7d0e730a3a3ed98c89dd33c4ac16edc82de8a.zip
Auto merge of #134478 - compiler-errors:attr-span, r=oli-obk
Properly record metavar spans for other expansions other than TT

This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result.

Fixes #132908
Alternative to #133270

cc `@ehuss`
cc `@petrochenkov`
Diffstat (limited to 'tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed')
-rw-r--r--tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed
index 8b179f7ef93..cba3d7f1f9f 100644
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed
@@ -40,6 +40,15 @@ macro_rules! meta2 {
     }
 }
 
+macro_rules! with_cfg_attr {
+    () => {
+        #[cfg_attr(all(), unsafe(link_section = ".custom_section"))]
+        //~^ ERROR: unsafe attribute used without unsafe
+        //~| WARN this is accepted in the current edition
+        pub extern "C" fn abc() {}
+    };
+}
+
 tt!([unsafe(no_mangle)]);
 //~^ ERROR: unsafe attribute used without unsafe
 //~| WARN this is accepted in the current edition
@@ -52,6 +61,8 @@ meta2!(unsafe(export_name = "baw"));
 //~| WARN this is accepted in the current edition
 ident2!(export_name, "bars");
 
+with_cfg_attr!();
+
 #[unsafe(no_mangle)]
 //~^ ERROR: unsafe attribute used without unsafe
 //~| WARN this is accepted in the current edition