about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorhdelc <hdelc02@gmail.com>2022-08-02 23:11:22 -0400
committerhdelc <hdelc02@gmail.com>2022-08-02 23:11:22 -0400
commit2be00947bfbb7e31cd6a5b6cf1e9e2f0bc1c4da6 (patch)
tree2d42fe432758a3d2e64b1d3c93b7f9259d18c16b /compiler
parent1e8abe7da2ea02af86e840716e241ca0fec653f2 (diff)
downloadrust-2be00947bfbb7e31cd6a5b6cf1e9e2f0bc1c4da6.tar.gz
rust-2be00947bfbb7e31cd6a5b6cf1e9e2f0bc1c4da6.zip
Add items to `DocAliasBadLocation` check error match arm
- Added `Impl`, `Closure`, ForeignMod` targets
- `Target::name` changed for `Target::Impl`
- Error output for `Target::ForeignMod` changed to "foreign module"
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir/src/target.rs2
-rw-r--r--compiler/rustc_passes/src/check_attr.rs10
2 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_hir/src/target.rs b/compiler/rustc_hir/src/target.rs
index 178e381f5a3..6236dea10c8 100644
--- a/compiler/rustc_hir/src/target.rs
+++ b/compiler/rustc_hir/src/target.rs
@@ -162,7 +162,7 @@ impl Target {
             Target::Union => "union",
             Target::Trait => "trait",
             Target::TraitAlias => "trait alias",
-            Target::Impl => "item",
+            Target::Impl => "implementation block",
             Target::Expression => "expression",
             Target::Statement => "statement",
             Target::Arm => "match arm",
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 4ff706ddfc3..5b7d44e41cf 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -596,8 +596,6 @@ impl CheckAttrVisitor<'_> {
 
         let span = meta.span();
         if let Some(location) = match target {
-            Target::Impl => Some("implementation block"),
-            Target::ForeignMod => Some("extern block"),
             Target::AssocTy => {
                 let parent_hir_id = self.tcx.hir().get_parent_item(hir_id);
                 let containing_item = self.tcx.hir().expect_item(parent_hir_id);
@@ -619,13 +617,17 @@ impl CheckAttrVisitor<'_> {
             }
             // we check the validity of params elsewhere
             Target::Param => return false,
-            Target::Expression | Target::Statement | Target::Arm => Some(target.name()),
+            Target::Expression
+            | Target::Statement
+            | Target::Arm
+            | Target::ForeignMod
+            | Target::Closure
+            | Target::Impl => Some(target.name()),
             Target::ExternCrate
             | Target::Use
             | Target::Static
             | Target::Const
             | Target::Fn
-            | Target::Closure
             | Target::Mod
             | Target::GlobalAsm
             | Target::TyAlias