about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-04 16:28:59 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-23 09:53:04 +0000
commitd5c0f4d139b76cdf91182486d7def996a4faeb5f (patch)
tree1ac1010204618fe4e3d8ade3b736dc74d309bd48
parent9088ba9f3edd5f7e1c6e327093328fd9aa822ff4 (diff)
downloadrust-d5c0f4d139b76cdf91182486d7def996a4faeb5f.tar.gz
rust-d5c0f4d139b76cdf91182486d7def996a4faeb5f.zip
Sync the logic for inherent and weak type aliases
-rw-r--r--compiler/rustc_privacy/src/lib.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs
index f2d6a0dff9c..1fb54df60f7 100644
--- a/compiler/rustc_privacy/src/lib.rs
+++ b/compiler/rustc_privacy/src/lib.rs
@@ -210,9 +210,6 @@ where
                     }
                 }
             }
-            ty::Alias(ty::Weak, alias) => {
-                self.def_id_visitor.visit_def_id(alias.def_id, "type alias", &ty);
-            }
             ty::Alias(ty::Projection, proj) => {
                 if V::SKIP_ASSOC_TYS {
                     // Visitors searching for minimal visibility/reachability want to
@@ -225,7 +222,7 @@ where
                 // This will also visit args if necessary, so we don't need to recurse.
                 return self.visit_projection_ty(proj);
             }
-            ty::Alias(ty::Inherent, data) => {
+            ty::Alias(kind @ (ty::Inherent | ty::Weak), data) => {
                 if V::SKIP_ASSOC_TYS {
                     // Visitors searching for minimal visibility/reachability want to
                     // conservatively approximate associated types like `Type::Alias`
@@ -237,7 +234,11 @@ where
 
                 self.def_id_visitor.visit_def_id(
                     data.def_id,
-                    "associated type",
+                    match kind {
+                        ty::Inherent => "associated type",
+                        ty::Weak => "type alias",
+                        _ => unreachable!(),
+                    },
                     &LazyDefPathStr { def_id: data.def_id, tcx },
                 )?;