Skip to content

Commit c4e7cb8

Browse files
Implement check_attr
1 parent 39235be commit c4e7cb8

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
@@ -130,6 +130,22 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
130130
for attr in attrs {
131131
let mut style = None;
132132
match attr {
133+
Attribute::Parsed(AttributeKind::ProcMacro(_)) => {
134+
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
135+
}
136+
Attribute::Parsed(AttributeKind::ProcMacroAttribute(_)) => {
137+
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
138+
}
139+
Attribute::Parsed(AttributeKind::ProcMacroDerive { span: attr_span, .. }) => {
140+
self.check_generic_attr(
141+
hir_id,
142+
sym::proc_macro_derive,
143+
*attr_span,
144+
target,
145+
Target::Fn,
146+
);
147+
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
148+
}
133149
Attribute::Parsed(
134150
AttributeKind::SkipDuringMethodDispatch { span: attr_span, .. }
135151
| AttributeKind::Coinductive(attr_span)
@@ -275,6 +291,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
275291
| AttributeKind::MacroTransparency(_)
276292
| AttributeKind::Pointee(..)
277293
| AttributeKind::Dummy
294+
| AttributeKind::RustcBuiltinMacro { .. }
278295
| AttributeKind::OmitGdbPrettyPrinterSection,
279296
) => { /* do nothing */ }
280297
Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => {
@@ -373,16 +390,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
373390
[sym::should_panic, ..] => {
374391
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn)
375392
}
376-
[sym::proc_macro, ..] => {
377-
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
378-
}
379-
[sym::proc_macro_attribute, ..] => {
380-
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
381-
}
382-
[sym::proc_macro_derive, ..] => {
383-
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn);
384-
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
385-
}
386393
[sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
387394
self.check_autodiff(hir_id, attr, span, target)
388395
}

0 commit comments

Comments
 (0)