Skip to content

Commit fa14d02

Browse files
Remove Clean trait implementation for ty::TraitRef
1 parent 482153b commit fa14d02

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
120120
kind: Box::new(ImplItem(Box::new(Impl {
121121
unsafety: hir::Unsafety::Normal,
122122
generics: new_generics,
123-
trait_: Some(trait_ref.clean(self.cx)),
123+
trait_: Some(clean_trait_ref_with_bindings(self.cx, trait_ref, &[])),
124124
for_: clean_middle_ty(ty, self.cx, None),
125125
items: Vec::new(),
126126
polarity,

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
115115
),
116116
// FIXME(eddyb) compute both `trait_` and `for_` from
117117
// the post-inference `trait_ref`, as it's more accurate.
118-
trait_: Some(trait_ref.0.clean(cx)),
118+
trait_: Some(clean_trait_ref_with_bindings(cx, trait_ref.0, &[])),
119119
for_: clean_middle_ty(ty.0, cx, None),
120120
items: cx.tcx
121121
.associated_items(impl_def_id)

src/librustdoc/clean/inline.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ 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_middle_field, clean_middle_ty, clean_ty,
20-
clean_ty_generics, clean_variant_def, clean_visibility, utils, Attributes, AttributesExt,
21-
Clean, ImplKind, ItemId, Type, Visibility,
19+
self, clean_fn_decl_from_did_and_sig, clean_middle_field, clean_middle_ty,
20+
clean_trait_ref_with_bindings, clean_ty, clean_ty_generics, clean_variant_def,
21+
clean_visibility, utils, Attributes, AttributesExt, Clean, ImplKind, ItemId, Type, Visibility,
2222
};
2323
use crate::core::DocContext;
2424
use crate::formats::item_type::ItemType;
@@ -450,7 +450,7 @@ pub(crate) fn build_impl(
450450
),
451451
};
452452
let polarity = tcx.impl_polarity(did);
453-
let trait_ = associated_trait.map(|t| t.clean(cx));
453+
let trait_ = associated_trait.map(|t| clean_trait_ref_with_bindings(cx, t, &[]));
454454
if trait_.as_ref().map(|t| t.def_id()) == tcx.lang_items().deref_trait() {
455455
super::build_deref_target_impls(cx, &trait_items, ret);
456456
}

src/librustdoc/clean/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<'tcx> Clean<'tcx, Option<GenericBound>> for hir::GenericBound<'tcx> {
163163
}
164164
}
165165

166-
fn clean_trait_ref_with_bindings<'tcx>(
166+
pub(crate) fn clean_trait_ref_with_bindings<'tcx>(
167167
cx: &mut DocContext<'tcx>,
168168
trait_ref: ty::TraitRef<'tcx>,
169169
bindings: &[TypeBinding],
@@ -180,12 +180,6 @@ fn clean_trait_ref_with_bindings<'tcx>(
180180
path
181181
}
182182

183-
impl<'tcx> Clean<'tcx, Path> for ty::TraitRef<'tcx> {
184-
fn clean(&self, cx: &mut DocContext<'tcx>) -> Path {
185-
clean_trait_ref_with_bindings(cx, *self, &[])
186-
}
187-
}
188-
189183
fn clean_poly_trait_ref_with_bindings<'tcx>(
190184
cx: &mut DocContext<'tcx>,
191185
poly_trait_ref: ty::PolyTraitRef<'tcx>,
@@ -432,7 +426,7 @@ fn clean_projection<'tcx>(
432426
def_id: Option<DefId>,
433427
) -> Type {
434428
let lifted = ty.lift_to_tcx(cx.tcx).unwrap();
435-
let trait_ = lifted.trait_ref(cx.tcx).clean(cx);
429+
let trait_ = clean_trait_ref_with_bindings(cx, lifted.trait_ref(cx.tcx), &[]);
436430
let self_type = clean_middle_ty(ty.self_ty(), cx, None);
437431
let self_def_id = if let Some(def_id) = def_id {
438432
cx.tcx.opt_parent(def_id).or(Some(def_id))

0 commit comments

Comments
 (0)