about summary refs log tree commit diff
path: root/compiler/rustc_privacy/src/lib.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-12 10:18:30 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-23 10:10:22 +0000
commit5c9a74d88b6e585e49b62b0a8f45fe95abc70f7e (patch)
tree262f9f654c8052eaf214c27a72b0510bb010a1cc /compiler/rustc_privacy/src/lib.rs
parentd5c0f4d139b76cdf91182486d7def996a4faeb5f (diff)
downloadrust-5c9a74d88b6e585e49b62b0a8f45fe95abc70f7e.tar.gz
rust-5c9a74d88b6e585e49b62b0a8f45fe95abc70f7e.zip
Merge associated types with the other alias types
Diffstat (limited to 'compiler/rustc_privacy/src/lib.rs')
-rw-r--r--compiler/rustc_privacy/src/lib.rs25
1 files changed, 7 insertions, 18 deletions
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs
index 1fb54df60f7..4bb7e65747f 100644
--- a/compiler/rustc_privacy/src/lib.rs
+++ b/compiler/rustc_privacy/src/lib.rs
@@ -210,19 +210,7 @@ where
                     }
                 }
             }
-            ty::Alias(ty::Projection, proj) => {
-                if V::SKIP_ASSOC_TYS {
-                    // Visitors searching for minimal visibility/reachability want to
-                    // conservatively approximate associated types like `<Type as Trait>::Alias`
-                    // as visible/reachable even if both `Type` and `Trait` are private.
-                    // Ideally, associated types should be substituted in the same way as
-                    // free type aliases, but this isn't done yet.
-                    return ControlFlow::Continue(());
-                }
-                // This will also visit args if necessary, so we don't need to recurse.
-                return self.visit_projection_ty(proj);
-            }
-            ty::Alias(kind @ (ty::Inherent | ty::Weak), data) => {
+            ty::Alias(kind @ (ty::Inherent | ty::Weak | ty::Projection), data) => {
                 if V::SKIP_ASSOC_TYS {
                     // Visitors searching for minimal visibility/reachability want to
                     // conservatively approximate associated types like `Type::Alias`
@@ -232,13 +220,14 @@ where
                     return ControlFlow::Continue(());
                 }
 
+                let kind = match kind {
+                    ty::Inherent | ty::Projection => "associated type",
+                    ty::Weak => "type alias",
+                    ty::Opaque => unreachable!(),
+                };
                 self.def_id_visitor.visit_def_id(
                     data.def_id,
-                    match kind {
-                        ty::Inherent => "associated type",
-                        ty::Weak => "type alias",
-                        _ => unreachable!(),
-                    },
+                    kind,
                     &LazyDefPathStr { def_id: data.def_id, tcx },
                 )?;