Skip to content

Commit 991ec52

Browse files
Implement check_attr
1 parent 3ea8b10 commit 991ec52

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)
@@ -253,6 +269,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
253269
| AttributeKind::MacroTransparency(_)
254270
| AttributeKind::Pointee(..)
255271
| AttributeKind::Dummy
272+
| AttributeKind::RustcBuiltinMacro { .. }
256273
| AttributeKind::OmitGdbPrettyPrinterSection,
257274
) => { /* do nothing */ }
258275
Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => {
@@ -352,16 +369,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
352369
[sym::should_panic, ..] => {
353370
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn)
354371
}
355-
[sym::proc_macro, ..] => {
356-
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
357-
}
358-
[sym::proc_macro_attribute, ..] => {
359-
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
360-
}
361-
[sym::proc_macro_derive, ..] => {
362-
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn);
363-
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
364-
}
365372
[sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
366373
self.check_autodiff(hir_id, attr, span, target)
367374
}

0 commit comments

Comments
 (0)