1
Fork 0

Remove ToPolyTraitRef impl for TraitRef

This commit is contained in:
jackh726 2021-09-15 22:55:10 -04:00
parent be76bdf905
commit c065f57111
9 changed files with 33 additions and 45 deletions

View file

@ -769,12 +769,6 @@ pub trait ToPolyTraitRef<'tcx> {
fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx>;
}
impl<'tcx> ToPolyTraitRef<'tcx> for TraitRef<'tcx> {
fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx> {
ty::Binder::dummy(*self)
}
}
impl<'tcx> ToPolyTraitRef<'tcx> for PolyTraitPredicate<'tcx> {
fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx> {
self.map_bound_ref(|trait_pred| trait_pred.trait_ref)

View file

@ -844,8 +844,11 @@ impl<'tcx> TraitRef<'tcx> {
/// Returns a `TraitRef` of the form `P0: Foo<P1..Pn>` where `Pi`
/// are the parameters defined on trait.
pub fn identity(tcx: TyCtxt<'tcx>, def_id: DefId) -> TraitRef<'tcx> {
TraitRef { def_id, substs: InternalSubsts::identity_for_item(tcx, def_id) }
pub fn identity(tcx: TyCtxt<'tcx>, def_id: DefId) -> Binder<'tcx, TraitRef<'tcx>> {
ty::Binder::dummy(TraitRef {
def_id,
substs: InternalSubsts::identity_for_item(tcx, def_id),
})
}
#[inline]