@@ -547,10 +547,11 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
547547
548548 if let PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) = context {
549549 let tcx = self . tcx ( ) ;
550- let trait_ref = ty:: TraitRef {
551- def_id : tcx. require_lang_item ( LangItem :: Copy , Some ( self . last_span ) ) ,
552- substs : tcx. mk_substs_trait ( place_ty. ty , & [ ] ) ,
553- } ;
550+ let trait_ref = tcx. mk_trait_ref (
551+ tcx. require_lang_item ( LangItem :: Copy , Some ( self . last_span ) ) ,
552+ place_ty. ty ,
553+ & [ ] ,
554+ ) ;
554555
555556 // To have a `Copy` operand, the type `T` of the
556557 // value must be `Copy`. Note that we prove that `T: Copy`,
@@ -1273,10 +1274,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12731274
12741275 self . check_rvalue ( body, rv, location) ;
12751276 if !self . unsized_feature_enabled ( ) {
1276- let trait_ref = ty:: TraitRef {
1277- def_id : tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1278- substs : tcx. mk_substs_trait ( place_ty, & [ ] ) ,
1279- } ;
1277+ let trait_ref = tcx. mk_trait_ref (
1278+ tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1279+ place_ty,
1280+ & [ ] ,
1281+ ) ;
12801282 self . prove_trait_ref (
12811283 trait_ref,
12821284 location. to_locations ( ) ,
@@ -1865,9 +1867,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18651867 // Make sure that repeated elements implement `Copy`.
18661868 let span = body. source_info ( location) . span ;
18671869 let ty = place. ty ( body, tcx) . ty ;
1868- let trait_ref = ty :: TraitRef :: new (
1870+ let trait_ref = tcx . mk_trait_ref (
18691871 tcx. require_lang_item ( LangItem :: Copy , Some ( span) ) ,
1870- tcx. mk_substs_trait ( ty, & [ ] ) ,
1872+ ty,
1873+ & [ ] ,
18711874 ) ;
18721875
18731876 self . prove_trait_ref (
@@ -1881,10 +1884,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18811884 }
18821885
18831886 & Rvalue :: NullaryOp ( NullOp :: SizeOf | NullOp :: AlignOf , ty) => {
1884- let trait_ref = ty:: TraitRef {
1885- def_id : tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1886- substs : tcx. mk_substs_trait ( ty, & [ ] ) ,
1887- } ;
1887+ let trait_ref = tcx. mk_trait_ref (
1888+ tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1889+ ty,
1890+ & [ ] ,
1891+ ) ;
18881892
18891893 self . prove_trait_ref (
18901894 trait_ref,
@@ -1896,10 +1900,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18961900 Rvalue :: ShallowInitBox ( operand, ty) => {
18971901 self . check_operand ( operand, location) ;
18981902
1899- let trait_ref = ty:: TraitRef {
1900- def_id : tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1901- substs : tcx. mk_substs_trait ( * ty, & [ ] ) ,
1902- } ;
1903+ let trait_ref = tcx. mk_trait_ref (
1904+ tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1905+ * ty,
1906+ & [ ] ,
1907+ ) ;
19031908
19041909 self . prove_trait_ref (
19051910 trait_ref,
@@ -1996,11 +2001,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19962001
19972002 CastKind :: Pointer ( PointerCast :: Unsize ) => {
19982003 let & ty = ty;
1999- let trait_ref = ty :: TraitRef {
2000- def_id : tcx
2001- . require_lang_item ( LangItem :: CoerceUnsized , Some ( self . last_span ) ) ,
2002- substs : tcx . mk_substs_trait ( op . ty ( body , tcx ) , & [ ty. into ( ) ] ) ,
2003- } ;
2004+ let trait_ref = tcx . mk_trait_ref (
2005+ tcx . require_lang_item ( LangItem :: CoerceUnsized , Some ( self . last_span ) ) ,
2006+ op . ty ( body , tcx ) ,
2007+ & [ ty. into ( ) ] ,
2008+ ) ;
20042009
20052010 self . prove_trait_ref (
20062011 trait_ref,
0 commit comments