@@ -963,20 +963,13 @@ pub struct ExistentialTraitRef<'tcx> {
963
963
pub substs : SubstsRef < ' tcx > ,
964
964
}
965
965
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 }
978
969
}
970
+ }
979
971
972
+ impl < ' tcx > ExistentialTraitRef < ' tcx > {
980
973
/// Object types don't have a self type specified. Therefore, when
981
974
/// we convert the principal trait-ref into a normal trait-ref,
982
975
/// you must give *some* self type. A common choice is `mk_err()`
@@ -1532,6 +1525,16 @@ pub struct ExistentialProjection<'tcx> {
1532
1525
pub ty : Ty < ' tcx > ,
1533
1526
}
1534
1527
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
+
1535
1538
pub type PolyExistentialProjection < ' tcx > = Binder < ' tcx , ExistentialProjection < ' tcx > > ;
1536
1539
1537
1540
impl < ' tcx > ExistentialProjection < ' tcx > {
@@ -1562,20 +1565,6 @@ impl<'tcx> ExistentialProjection<'tcx> {
1562
1565
ty : self . ty ,
1563
1566
}
1564
1567
}
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
- }
1579
1568
}
1580
1569
1581
1570
impl < ' tcx > PolyExistentialProjection < ' tcx > {
0 commit comments