Merge associated types with the other alias types

This commit is contained in:
Oli Scherer 2023-07-12 10:18:30 +00:00
parent d5c0f4d139
commit 5c9a74d88b
5 changed files with 24 additions and 35 deletions

View file

@ -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 },
)?;