Skip to content

Commit 7a9f307

Browse files
Remove Clean trait implementation for hir::Ty and middle::Ty
1 parent 47ba935 commit 7a9f307

File tree

5 files changed

+153
-136
lines changed

5 files changed

+153
-136
lines changed

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
121121
unsafety: hir::Unsafety::Normal,
122122
generics: new_generics,
123123
trait_: Some(trait_ref.clean(self.cx)),
124-
for_: ty.clean(self.cx),
124+
for_: clean_middle_ty(ty, self.cx, None),
125125
items: Vec::new(),
126126
polarity,
127127
kind: ImplKind::Auto,

src/librustdoc/clean/blanket_impl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
116116
// FIXME(eddyb) compute both `trait_` and `for_` from
117117
// the post-inference `trait_ref`, as it's more accurate.
118118
trait_: Some(trait_ref.0.clean(cx)),
119-
for_: ty.0.clean(cx),
119+
for_: clean_middle_ty(ty.0, cx, None),
120120
items: cx.tcx
121121
.associated_items(impl_def_id)
122122
.in_definition_order()
123123
.map(|x| x.clean(cx))
124124
.collect::<Vec<_>>(),
125125
polarity: ty::ImplPolarity::Positive,
126-
kind: ImplKind::Blanket(Box::new(trait_ref.0.self_ty().clean(cx))),
126+
kind: ImplKind::Blanket(Box::new(clean_middle_ty(trait_ref.0.self_ty(), cx, None))),
127127
})),
128128
cfg: None,
129129
});

src/librustdoc/clean/inline.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_span::hygiene::MacroKind;
1616
use rustc_span::symbol::{kw, sym, Symbol};
1717

1818
use crate::clean::{
19-
self, clean_fn_decl_from_did_and_sig, clean_ty_generics, utils, Attributes, AttributesExt,
20-
Clean, ImplKind, ItemId, Type, Visibility,
19+
self, clean_fn_decl_from_did_and_sig, clean_middle_ty, clean_ty, clean_ty_generics, utils,
20+
Attributes, AttributesExt, Clean, ImplKind, ItemId, Type, Visibility,
2121
};
2222
use crate::core::DocContext;
2323
use crate::formats::item_type::ItemType;
@@ -261,7 +261,7 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union {
261261

262262
fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> clean::Typedef {
263263
let predicates = cx.tcx.explicit_predicates_of(did);
264-
let type_ = cx.tcx.type_of(did).clean(cx);
264+
let type_ = clean_middle_ty(cx.tcx.type_of(did), cx, Some(did));
265265

266266
clean::Typedef {
267267
type_,
@@ -357,8 +357,8 @@ pub(crate) fn build_impl(
357357
};
358358

359359
let for_ = match &impl_item {
360-
Some(impl_) => impl_.self_ty.clean(cx),
361-
None => tcx.type_of(did).clean(cx),
360+
Some(impl_) => clean_ty(impl_.self_ty, cx),
361+
None => clean_middle_ty(tcx.type_of(did), cx, Some(did)),
362362
};
363363

364364
// Only inline impl if the implementing type is
@@ -577,14 +577,14 @@ pub(crate) fn print_inlined_const(tcx: TyCtxt<'_>, did: DefId) -> String {
577577

578578
fn build_const(cx: &mut DocContext<'_>, def_id: DefId) -> clean::Constant {
579579
clean::Constant {
580-
type_: cx.tcx.type_of(def_id).clean(cx),
580+
type_: clean_middle_ty(cx.tcx.type_of(def_id), cx, Some(def_id)),
581581
kind: clean::ConstantKind::Extern { def_id },
582582
}
583583
}
584584

585585
fn build_static(cx: &mut DocContext<'_>, did: DefId, mutable: bool) -> clean::Static {
586586
clean::Static {
587-
type_: cx.tcx.type_of(did).clean(cx),
587+
type_: clean_middle_ty(cx.tcx.type_of(did), cx, Some(did)),
588588
mutability: if mutable { Mutability::Mut } else { Mutability::Not },
589589
expr: None,
590590
}

0 commit comments

Comments
 (0)