Pre intern the Self parameter type
Use this to simplify the object safety code a bit.
This commit is contained in:
parent
165e460c92
commit
24587d20df
10 changed files with 35 additions and 47 deletions
|
|
@ -2303,7 +2303,7 @@ impl Clean<Item> for ty::AssocItem {
|
|||
ty::ImplContainer(def_id) => {
|
||||
cx.tcx.type_of(def_id)
|
||||
}
|
||||
ty::TraitContainer(_) => cx.tcx.mk_self_type()
|
||||
ty::TraitContainer(_) => cx.tcx.types.self_param,
|
||||
};
|
||||
let self_arg_ty = *sig.input(0).skip_binder();
|
||||
if self_arg_ty == self_ty {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId,
|
|||
}
|
||||
let predicates = cx.tcx.super_predicates_of(child);
|
||||
debug_assert!(cx.tcx.generics_of(child).has_self);
|
||||
let self_ty = cx.tcx.mk_self_type();
|
||||
let self_ty = cx.tcx.types.self_param;
|
||||
predicates.predicates.iter().filter_map(|(pred, _)| {
|
||||
if let ty::Predicate::Trait(ref pred) = *pred {
|
||||
if pred.skip_binder().trait_ref.self_ty() == self_ty {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue