@@ -818,14 +818,10 @@ pub struct TraitRef<'tcx> {
818818 pub substs : SubstsRef < ' tcx > ,
819819 /// This field exists to prevent the creation of `TraitRef` without
820820 /// calling [TyCtxt::mk_trait_ref].
821- _use_mk_trait_ref_instead : ( ) ,
821+ pub ( super ) _use_mk_trait_ref_instead : ( ) ,
822822}
823823
824824impl < ' tcx > TraitRef < ' tcx > {
825- pub fn new ( def_id : DefId , substs : SubstsRef < ' tcx > ) -> TraitRef < ' tcx > {
826- TraitRef { def_id, substs, _use_mk_trait_ref_instead : ( ) }
827- }
828-
829825 pub fn with_self_ty ( self , tcx : TyCtxt < ' tcx > , self_ty : Ty < ' tcx > ) -> Self {
830826 tcx. mk_trait_ref (
831827 self . def_id ,
@@ -836,11 +832,7 @@ impl<'tcx> TraitRef<'tcx> {
836832 /// Returns a `TraitRef` of the form `P0: Foo<P1..Pn>` where `Pi`
837833 /// are the parameters defined on trait.
838834 pub fn identity ( tcx : TyCtxt < ' tcx > , def_id : DefId ) -> Binder < ' tcx , TraitRef < ' tcx > > {
839- ty:: Binder :: dummy ( TraitRef {
840- def_id,
841- substs : InternalSubsts :: identity_for_item ( tcx, def_id) ,
842- _use_mk_trait_ref_instead : ( ) ,
843- } )
835+ ty:: Binder :: dummy ( tcx. mk_trait_ref ( def_id, InternalSubsts :: identity_for_item ( tcx, def_id) ) )
844836 }
845837
846838 #[ inline]
@@ -854,11 +846,7 @@ impl<'tcx> TraitRef<'tcx> {
854846 substs : SubstsRef < ' tcx > ,
855847 ) -> ty:: TraitRef < ' tcx > {
856848 let defs = tcx. generics_of ( trait_id) ;
857- ty:: TraitRef {
858- def_id : trait_id,
859- substs : tcx. intern_substs ( & substs[ ..defs. params . len ( ) ] ) ,
860- _use_mk_trait_ref_instead : ( ) ,
861- }
849+ tcx. mk_trait_ref ( trait_id, tcx. intern_substs ( & substs[ ..defs. params . len ( ) ] ) )
862850 }
863851}
864852
0 commit comments