@@ -728,13 +728,13 @@ impl<'tcx> PolyExistentialPredicate<'tcx> {
728
728
ExistentialPredicate :: AutoTrait ( did) => {
729
729
let generics = tcx. generics_of ( did) ;
730
730
let trait_ref = if generics. params . len ( ) == 1 {
731
- tcx . mk_trait_ref ( did, [ self_ty] )
731
+ ty :: TraitRef :: new ( tcx , did, [ self_ty] )
732
732
} else {
733
733
// If this is an ill-formed auto trait, then synthesize
734
734
// new error substs for the missing generics.
735
735
let err_substs =
736
736
ty:: InternalSubsts :: extend_with_error ( tcx, did, & [ self_ty. into ( ) ] ) ;
737
- tcx . mk_trait_ref ( did, err_substs)
737
+ ty :: TraitRef :: new ( tcx , did, err_substs)
738
738
} ;
739
739
self . rebind ( trait_ref) . without_const ( ) . to_predicate ( tcx)
740
740
}
@@ -850,17 +850,22 @@ impl<'tcx> TraitRef<'tcx> {
850
850
substs : SubstsRef < ' tcx > ,
851
851
) -> ty:: TraitRef < ' tcx > {
852
852
let defs = tcx. generics_of ( trait_id) ;
853
- tcx . mk_trait_ref ( trait_id, tcx. mk_substs ( & substs[ ..defs. params . len ( ) ] ) )
853
+ ty :: TraitRef :: new ( tcx , trait_id, tcx. mk_substs ( & substs[ ..defs. params . len ( ) ] ) )
854
854
}
855
855
856
856
/// Returns a `TraitRef` of the form `P0: Foo<P1..Pn>` where `Pi`
857
857
/// are the parameters defined on trait.
858
858
pub fn identity ( tcx : TyCtxt < ' tcx > , def_id : DefId ) -> Binder < ' tcx , TraitRef < ' tcx > > {
859
- ty:: Binder :: dummy ( tcx. mk_trait_ref ( def_id, InternalSubsts :: identity_for_item ( tcx, def_id) ) )
859
+ ty:: Binder :: dummy ( ty:: TraitRef :: new (
860
+ tcx,
861
+ def_id,
862
+ InternalSubsts :: identity_for_item ( tcx, def_id) ,
863
+ ) )
860
864
}
861
865
862
866
pub fn with_self_ty ( self , tcx : TyCtxt < ' tcx > , self_ty : Ty < ' tcx > ) -> Self {
863
- tcx. mk_trait_ref (
867
+ ty:: TraitRef :: new (
868
+ tcx,
864
869
self . def_id ,
865
870
[ self_ty. into ( ) ] . into_iter ( ) . chain ( self . substs . iter ( ) . skip ( 1 ) ) ,
866
871
)
@@ -926,7 +931,7 @@ impl<'tcx> ExistentialTraitRef<'tcx> {
926
931
// otherwise the escaping vars would be captured by the binder
927
932
// debug_assert!(!self_ty.has_escaping_bound_vars());
928
933
929
- tcx . mk_trait_ref ( self . def_id , [ self_ty. into ( ) ] . into_iter ( ) . chain ( self . substs . iter ( ) ) )
934
+ ty :: TraitRef :: new ( tcx , self . def_id , [ self_ty. into ( ) ] . into_iter ( ) . chain ( self . substs . iter ( ) ) )
930
935
}
931
936
}
932
937
@@ -1245,7 +1250,7 @@ impl<'tcx> AliasTy<'tcx> {
1245
1250
let trait_def_id = self . trait_def_id ( tcx) ;
1246
1251
let trait_generics = tcx. generics_of ( trait_def_id) ;
1247
1252
(
1248
- tcx . mk_trait_ref ( trait_def_id, self . substs . truncate_to ( tcx, trait_generics) ) ,
1253
+ ty :: TraitRef :: new ( tcx , trait_def_id, self . substs . truncate_to ( tcx, trait_generics) ) ,
1249
1254
& self . substs [ trait_generics. count ( ) ..] ,
1250
1255
)
1251
1256
}
@@ -1259,7 +1264,7 @@ impl<'tcx> AliasTy<'tcx> {
1259
1264
/// as well.
1260
1265
pub fn trait_ref ( self , tcx : TyCtxt < ' tcx > ) -> ty:: TraitRef < ' tcx > {
1261
1266
let def_id = self . trait_def_id ( tcx) ;
1262
- tcx . mk_trait_ref ( def_id, self . substs . truncate_to ( tcx, tcx. generics_of ( def_id) ) )
1267
+ ty :: TraitRef :: new ( tcx , def_id, self . substs . truncate_to ( tcx, tcx. generics_of ( def_id) ) )
1263
1268
}
1264
1269
1265
1270
pub fn self_ty ( self ) -> Ty < ' tcx > {
0 commit comments