From d5c0f4d139b76cdf91182486d7def996a4faeb5f Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 4 Jul 2023 16:28:59 +0000 Subject: [PATCH] Sync the logic for inherent and weak type aliases --- compiler/rustc_privacy/src/lib.rs | 11 ++++++----- 1 file 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 }, )?;