@@ -963,20 +963,13 @@ pub struct ExistentialTraitRef<'tcx> {
963963 pub substs : SubstsRef < ' tcx > ,
964964}
965965
966- impl < ' tcx > ExistentialTraitRef < ' tcx > {
967- pub fn erase_self_ty (
968- tcx : TyCtxt < ' tcx > ,
969- trait_ref : ty:: TraitRef < ' tcx > ,
970- ) -> ty:: ExistentialTraitRef < ' tcx > {
971- // Assert there is a Self.
972- trait_ref. substs . type_at ( 0 ) ;
973-
974- ty:: ExistentialTraitRef {
975- def_id : trait_ref. def_id ,
976- substs : tcx. intern_substs ( & trait_ref. substs [ 1 ..] ) ,
977- }
966+ impl From < TraitRef < ' tcx > > for ExistentialTraitRef < ' tcx > {
967+ fn from ( trait_ref : TraitRef < ' tcx > ) -> Self {
968+ Self { def_id : trait_ref. def_id , substs : trait_ref. substs }
978969 }
970+ }
979971
972+ impl < ' tcx > ExistentialTraitRef < ' tcx > {
980973 /// Object types don't have a self type specified. Therefore, when
981974 /// we convert the principal trait-ref into a normal trait-ref,
982975 /// you must give *some* self type. A common choice is `mk_err()`
@@ -1532,6 +1525,16 @@ pub struct ExistentialProjection<'tcx> {
15321525 pub ty : Ty < ' tcx > ,
15331526}
15341527
1528+ impl From < ty:: ProjectionPredicate < ' tcx > > for ExistentialProjection < ' tcx > {
1529+ fn from ( projection_predicate : ty:: ProjectionPredicate < ' tcx > ) -> Self {
1530+ Self {
1531+ item_def_id : projection_predicate. projection_ty . item_def_id ,
1532+ substs : projection_predicate. projection_ty . substs ,
1533+ ty : projection_predicate. ty ,
1534+ }
1535+ }
1536+ }
1537+
15351538pub type PolyExistentialProjection < ' tcx > = Binder < ' tcx , ExistentialProjection < ' tcx > > ;
15361539
15371540impl < ' tcx > ExistentialProjection < ' tcx > {
@@ -1562,20 +1565,6 @@ impl<'tcx> ExistentialProjection<'tcx> {
15621565 ty : self . ty ,
15631566 }
15641567 }
1565-
1566- pub fn erase_self_ty (
1567- tcx : TyCtxt < ' tcx > ,
1568- projection_predicate : ty:: ProjectionPredicate < ' tcx > ,
1569- ) -> Self {
1570- // Assert there is a Self.
1571- projection_predicate. projection_ty . substs . type_at ( 0 ) ;
1572-
1573- Self {
1574- item_def_id : projection_predicate. projection_ty . item_def_id ,
1575- substs : tcx. intern_substs ( & projection_predicate. projection_ty . substs [ 1 ..] ) ,
1576- ty : projection_predicate. ty ,
1577- }
1578- }
15791568}
15801569
15811570impl < ' tcx > PolyExistentialProjection < ' tcx > {
0 commit comments