Skip to content

Commit 8227e7f

Browse files
Implement check_attr
1 parent d64f8fc commit 8227e7f

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

compiler/rustc_passes/src/check_attr.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
123123
for attr in attrs {
124124
let mut style = None;
125125
match attr {
126+
Attribute::Parsed(AttributeKind::ProcMacro(_)) => {
127+
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
128+
}
129+
Attribute::Parsed(AttributeKind::ProcMacroAttribute(_)) => {
130+
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
131+
}
132+
Attribute::Parsed(AttributeKind::ProcMacroDerive { span: attr_span, .. }) => {
133+
self.check_generic_attr(
134+
hir_id,
135+
sym::proc_macro_derive,
136+
*attr_span,
137+
target,
138+
Target::Fn,
139+
);
140+
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
141+
}
126142
Attribute::Parsed(
127143
AttributeKind::SkipDuringMethodDispatch { span: attr_span, .. }
128144
| AttributeKind::Coinductive(attr_span)
@@ -252,6 +268,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
252268
| AttributeKind::ConstStabilityIndirect
253269
| AttributeKind::MacroTransparency(_)
254270
| AttributeKind::Dummy
271+
| AttributeKind::RustcBuiltinMacro { .. }
255272
| AttributeKind::OmitGdbPrettyPrinterSection,
256273
) => { /* do nothing */ }
257274
Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => {
@@ -351,16 +368,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
351368
[sym::should_panic, ..] => {
352369
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn)
353370
}
354-
[sym::proc_macro, ..] => {
355-
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
356-
}
357-
[sym::proc_macro_attribute, ..] => {
358-
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
359-
}
360-
[sym::proc_macro_derive, ..] => {
361-
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn);
362-
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
363-
}
364371
[sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
365372
self.check_autodiff(hir_id, attr, span, target)
366373
}

0 commit comments

Comments
 (0)