about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbohan <bohan-zhang@foxmail.com>2025-06-02 16:30:21 +0800
committerbohan <bohan-zhang@foxmail.com>2025-06-02 16:30:21 +0800
commit9b94caef4f18e850a43591984c5107692e14a702 (patch)
tree2c22c54339632419b4763aaba0c66a0631ed68f4 /compiler
parent91fad92585b2dafc52a074e502b2a6c1f093ca35 (diff)
allow macro_use as first segment
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 0777d442b59..5b7d45bb152 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -2312,7 +2312,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
     }
 
     fn check_macro_use(&self, hir_id: HirId, attr: &Attribute, target: Target) {
-        let name = attr.name().unwrap();
+        let Some(name) = attr.name() else {
+            return;
+        };
         match target {
             Target::ExternCrate | Target::Mod => {}
             _ => {