mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Add exhaustive location checking for doc_alias
attribute
This commit is contained in:
parent
6b37a79581
commit
c643007a56
@ -619,10 +619,30 @@ impl CheckAttrVisitor<'_> {
|
||||
}
|
||||
// we check the validity of params elsewhere
|
||||
Target::Param => return false,
|
||||
Target::Expression => Some("expression"),
|
||||
Target::Statement => Some("statement"),
|
||||
Target::Arm => Some("match arm"),
|
||||
_ => None,
|
||||
Target::Expression | Target::Statement | Target::Arm => Some(target.name()),
|
||||
Target::ExternCrate
|
||||
| Target::Use
|
||||
| Target::Static
|
||||
| Target::Const
|
||||
| Target::Fn
|
||||
| Target::Closure
|
||||
| Target::Mod
|
||||
| Target::GlobalAsm
|
||||
| Target::TyAlias
|
||||
| Target::OpaqueTy
|
||||
| Target::Enum
|
||||
| Target::Variant
|
||||
| Target::Struct
|
||||
| Target::Field
|
||||
| Target::Union
|
||||
| Target::Trait
|
||||
| Target::TraitAlias
|
||||
| Target::Method(..)
|
||||
| Target::ForeignFn
|
||||
| Target::ForeignStatic
|
||||
| Target::ForeignTy
|
||||
| Target::GenericParam(..)
|
||||
| Target::MacroDef => None,
|
||||
} {
|
||||
tcx.sess.emit_err(errors::DocAliasBadLocation { span, attr_str, location });
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user