Implement check_attr
This commit is contained in:
@@ -130,6 +130,22 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
for attr in attrs {
|
||||
let mut style = None;
|
||||
match attr {
|
||||
Attribute::Parsed(AttributeKind::ProcMacro(_)) => {
|
||||
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
|
||||
}
|
||||
Attribute::Parsed(AttributeKind::ProcMacroAttribute(_)) => {
|
||||
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
|
||||
}
|
||||
Attribute::Parsed(AttributeKind::ProcMacroDerive { span: attr_span, .. }) => {
|
||||
self.check_generic_attr(
|
||||
hir_id,
|
||||
sym::proc_macro_derive,
|
||||
*attr_span,
|
||||
target,
|
||||
Target::Fn,
|
||||
);
|
||||
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
|
||||
}
|
||||
Attribute::Parsed(
|
||||
AttributeKind::SkipDuringMethodDispatch { span: attr_span, .. }
|
||||
| AttributeKind::Coinductive(attr_span)
|
||||
@@ -275,6 +291,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
| AttributeKind::MacroTransparency(_)
|
||||
| AttributeKind::Pointee(..)
|
||||
| AttributeKind::Dummy
|
||||
| AttributeKind::RustcBuiltinMacro { .. }
|
||||
| AttributeKind::OmitGdbPrettyPrinterSection,
|
||||
) => { /* do nothing */ }
|
||||
Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => {
|
||||
@@ -373,16 +390,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
[sym::should_panic, ..] => {
|
||||
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn)
|
||||
}
|
||||
[sym::proc_macro, ..] => {
|
||||
self.check_proc_macro(hir_id, target, ProcMacroKind::FunctionLike)
|
||||
}
|
||||
[sym::proc_macro_attribute, ..] => {
|
||||
self.check_proc_macro(hir_id, target, ProcMacroKind::Attribute);
|
||||
}
|
||||
[sym::proc_macro_derive, ..] => {
|
||||
self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn);
|
||||
self.check_proc_macro(hir_id, target, ProcMacroKind::Derive)
|
||||
}
|
||||
[sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
|
||||
self.check_autodiff(hir_id, attr, span, target)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user