Skip to content

Commit d37c45f

Browse files
Implement check_attr
1 parent 27abc17 commit d37c45f

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

compiler/rustc_passes/src/check_attr.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,22 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
120120
for attr in attrs {
121121
let mut style = None;
122122
match attr {
123+
Attribute::Parsed(AttributeKind::ProcMacro(_)) => {
124+
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
125+
}
126+
Attribute::Parsed(AttributeKind::ProcMacroAttribute(_)) => {
127+
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
128+
}
129+
Attribute::Parsed(AttributeKind::ProcMacroDerive { span: attr_span, .. }) => {
130+
self.check_generic_attr(
131+
hir_id,
132+
sym::proc_macro_derive,
133+
*attr_span,
134+
target,
135+
Target::Fn,
136+
);
137+
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
138+
}
123139
Attribute::Parsed(AttributeKind::SkipDuringMethodDispatch {
124140
span: attr_span,
125141
..
@@ -217,7 +233,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
217233
AttributeKind::BodyStability { .. }
218234
| AttributeKind::ConstStabilityIndirect
219235
| AttributeKind::MacroTransparency(_)
220-
| AttributeKind::Dummy,
236+
| AttributeKind::Dummy
237+
| AttributeKind::RustcBuiltinMacro { .. },
221238
) => { /* do nothing */ }
222239
Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => {
223240
self.check_applied_to_fn_or_method(hir_id, *attr_span, span, target)
@@ -323,16 +340,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
323340
[sym::automatically_derived, ..] => {
324341
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Impl)
325342
}
326-
[sym::proc_macro, ..] => {
327-
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
328-
}
329-
[sym::proc_macro_attribute, ..] => {
330-
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
331-
}
332-
[sym::proc_macro_derive, ..] => {
333-
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn);
334-
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
335-
}
336343
[sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
337344
self.check_autodiff(hir_id, attr, span, target)
338345
}

0 commit comments

Comments
 (0)