@@ -538,7 +538,8 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
538538
539539 if let PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) = context {
540540 let tcx = self . tcx ( ) ;
541- let trait_ref = tcx. at ( self . last_span ) . mk_trait_ref ( LangItem :: Copy , [ place_ty. ty ] ) ;
541+ let trait_ref =
542+ ty:: TraitRef :: from_lang_item ( tcx. at ( self . last_span ) , LangItem :: Copy , [ place_ty. ty ] ) ;
542543
543544 // To have a `Copy` operand, the type `T` of the
544545 // value must be `Copy`. Note that we prove that `T: Copy`,
@@ -1237,8 +1238,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12371238
12381239 self . check_rvalue ( body, rv, location) ;
12391240 if !self . unsized_feature_enabled ( ) {
1240- let trait_ref =
1241- tcx. at ( self . last_span ) . mk_trait_ref ( LangItem :: Sized , [ place_ty] ) ;
1241+ let trait_ref = ty:: TraitRef :: from_lang_item (
1242+ tcx. at ( self . last_span ) ,
1243+ LangItem :: Sized ,
1244+ [ place_ty] ,
1245+ ) ;
12421246 self . prove_trait_ref (
12431247 trait_ref,
12441248 location. to_locations ( ) ,
@@ -1810,7 +1814,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18101814 Operand :: Move ( place) => {
18111815 // Make sure that repeated elements implement `Copy`.
18121816 let ty = place. ty ( body, tcx) . ty ;
1813- let trait_ref = tcx. at ( span) . mk_trait_ref ( LangItem :: Copy , [ ty] ) ;
1817+ let trait_ref =
1818+ ty:: TraitRef :: from_lang_item ( tcx. at ( span) , LangItem :: Copy , [ ty] ) ;
18141819
18151820 self . prove_trait_ref (
18161821 trait_ref,
@@ -1823,7 +1828,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18231828 }
18241829
18251830 & Rvalue :: NullaryOp ( NullOp :: SizeOf | NullOp :: AlignOf , ty) => {
1826- let trait_ref = tcx. at ( span) . mk_trait_ref ( LangItem :: Sized , [ ty] ) ;
1831+ let trait_ref = ty :: TraitRef :: from_lang_item ( tcx. at ( span) , LangItem :: Sized , [ ty] ) ;
18271832
18281833 self . prove_trait_ref (
18291834 trait_ref,
@@ -1835,7 +1840,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18351840 Rvalue :: ShallowInitBox ( operand, ty) => {
18361841 self . check_operand ( operand, location) ;
18371842
1838- let trait_ref = tcx. at ( span) . mk_trait_ref ( LangItem :: Sized , [ * ty] ) ;
1843+ let trait_ref = ty :: TraitRef :: from_lang_item ( tcx. at ( span) , LangItem :: Sized , [ * ty] ) ;
18391844
18401845 self . prove_trait_ref (
18411846 trait_ref,
@@ -1932,9 +1937,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19321937
19331938 CastKind :: Pointer ( PointerCast :: Unsize ) => {
19341939 let & ty = ty;
1935- let trait_ref = tcx
1936- . at ( span)
1937- . mk_trait_ref ( LangItem :: CoerceUnsized , [ op. ty ( body, tcx) , ty] ) ;
1940+ let trait_ref = ty:: TraitRef :: from_lang_item (
1941+ tcx. at ( span) ,
1942+ LangItem :: CoerceUnsized ,
1943+ [ op. ty ( body, tcx) , ty] ,
1944+ ) ;
19381945
19391946 self . prove_trait_ref (
19401947 trait_ref,
0 commit comments