mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
ty::Alias refactor: fix rustdoc
This commit is contained in:
@@ -1699,7 +1699,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
|
||||
let self_type = clean_ty(qself, cx);
|
||||
|
||||
let (trait_, should_fully_qualify) = match ty.kind() {
|
||||
ty::Alias(ty::Projection, proj) => {
|
||||
ty::Alias(proj @ ty::AliasTy { kind: ty::Projection { .. }, .. }) => {
|
||||
let res = Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id);
|
||||
let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx);
|
||||
register_res(cx, trait_.res);
|
||||
@@ -1709,7 +1709,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
|
||||
|
||||
(Some(trait_), should_fully_qualify)
|
||||
}
|
||||
ty::Alias(ty::Inherent, _) => (None, false),
|
||||
ty::Alias(ty::AliasTy { kind: ty::Inherent { .. }, .. }) => (None, false),
|
||||
// Rustdoc handles `ty::Error`s by turning them into `Type::Infer`s.
|
||||
ty::Error(_) => return Type::Infer,
|
||||
_ => bug!("clean: expected associated type, found `{ty:?}`"),
|
||||
@@ -2186,7 +2186,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
|
||||
Tuple(t.iter().map(|t| clean_middle_ty(bound_ty.rebind(t), cx, None, None)).collect())
|
||||
}
|
||||
|
||||
ty::Alias(ty::Projection, alias_ty @ ty::AliasTy { def_id, args, .. }) => {
|
||||
ty::Alias(alias_ty @ ty::AliasTy { kind: ty::Projection { def_id }, args, .. }) => {
|
||||
if cx.tcx.is_impl_trait_in_trait(def_id) {
|
||||
clean_middle_opaque_bounds(cx, def_id, args)
|
||||
} else {
|
||||
@@ -2198,7 +2198,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
ty::Alias(ty::Inherent, alias_ty @ ty::AliasTy { def_id, .. }) => {
|
||||
ty::Alias(alias_ty @ ty::AliasTy { kind: ty::Inherent { def_id }, .. }) => {
|
||||
let alias_ty = bound_ty.rebind(alias_ty);
|
||||
let self_type = clean_middle_ty(alias_ty.map_bound(|ty| ty.self_ty()), cx, None, None);
|
||||
|
||||
@@ -2221,7 +2221,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
|
||||
}))
|
||||
}
|
||||
|
||||
ty::Alias(ty::Free, ty::AliasTy { def_id, args, .. }) => {
|
||||
ty::Alias(ty::AliasTy { kind: ty::Free { def_id }, args, .. }) => {
|
||||
if cx.tcx.features().lazy_type_alias() {
|
||||
// Free type alias `data` represents the `type X` in `type X = Y`. If we need `Y`,
|
||||
// we need to use `type_of`.
|
||||
@@ -2249,7 +2249,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
|
||||
ty::BoundTyKind::Anon => panic!("unexpected anonymous bound type variable"),
|
||||
},
|
||||
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => {
|
||||
ty::Alias(ty::AliasTy { kind: ty::Opaque { def_id }, args, .. }) => {
|
||||
// If it's already in the same alias, don't get an infinite loop.
|
||||
if cx.current_type_aliases.contains_key(&def_id) {
|
||||
let path =
|
||||
|
||||
Reference in New Issue
Block a user