@@ -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, LangItem :: Copy , self . last_span , [ 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,12 @@ 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,
1243+ LangItem :: Sized ,
1244+ self . last_span ,
1245+ [ place_ty] ,
1246+ ) ;
12421247 self . prove_trait_ref (
12431248 trait_ref,
12441249 location. to_locations ( ) ,
@@ -1810,7 +1815,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18101815 Operand :: Move ( place) => {
18111816 // Make sure that repeated elements implement `Copy`.
18121817 let ty = place. ty ( body, tcx) . ty ;
1813- let trait_ref = tcx. at ( span) . mk_trait_ref ( LangItem :: Copy , [ ty] ) ;
1818+ let trait_ref =
1819+ ty:: TraitRef :: from_lang_item ( tcx, LangItem :: Copy , span, [ ty] ) ;
18141820
18151821 self . prove_trait_ref (
18161822 trait_ref,
@@ -1823,7 +1829,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18231829 }
18241830
18251831 & Rvalue :: NullaryOp ( NullOp :: SizeOf | NullOp :: AlignOf , ty) => {
1826- let trait_ref = tcx . at ( span ) . mk_trait_ref ( LangItem :: Sized , [ ty] ) ;
1832+ let trait_ref = ty :: TraitRef :: from_lang_item ( tcx , LangItem :: Sized , span , [ ty] ) ;
18271833
18281834 self . prove_trait_ref (
18291835 trait_ref,
@@ -1835,7 +1841,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18351841 Rvalue :: ShallowInitBox ( operand, ty) => {
18361842 self . check_operand ( operand, location) ;
18371843
1838- let trait_ref = tcx . at ( span ) . mk_trait_ref ( LangItem :: Sized , [ * ty] ) ;
1844+ let trait_ref = ty :: TraitRef :: from_lang_item ( tcx , LangItem :: Sized , span , [ * ty] ) ;
18391845
18401846 self . prove_trait_ref (
18411847 trait_ref,
@@ -1932,9 +1938,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19321938
19331939 CastKind :: Pointer ( PointerCast :: Unsize ) => {
19341940 let & ty = ty;
1935- let trait_ref = tcx
1936- . at ( span)
1937- . mk_trait_ref ( LangItem :: CoerceUnsized , [ op. ty ( body, tcx) , ty] ) ;
1941+ let trait_ref = ty:: TraitRef :: from_lang_item (
1942+ tcx,
1943+ LangItem :: CoerceUnsized ,
1944+ span,
1945+ [ op. ty ( body, tcx) , ty] ,
1946+ ) ;
19381947
19391948 self . prove_trait_ref (
19401949 trait_ref,
0 commit comments