@@ -538,7 +538,8 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
538
538
539
539
if let PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) = context {
540
540
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 ] ) ;
542
543
543
544
// To have a `Copy` operand, the type `T` of the
544
545
// value must be `Copy`. Note that we prove that `T: Copy`,
@@ -1237,8 +1238,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1237
1238
1238
1239
self . check_rvalue ( body, rv, location) ;
1239
1240
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
+ ) ;
1242
1246
self . prove_trait_ref (
1243
1247
trait_ref,
1244
1248
location. to_locations ( ) ,
@@ -1810,7 +1814,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1810
1814
Operand :: Move ( place) => {
1811
1815
// Make sure that repeated elements implement `Copy`.
1812
1816
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] ) ;
1814
1819
1815
1820
self . prove_trait_ref (
1816
1821
trait_ref,
@@ -1823,7 +1828,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1823
1828
}
1824
1829
1825
1830
& 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] ) ;
1827
1832
1828
1833
self . prove_trait_ref (
1829
1834
trait_ref,
@@ -1835,7 +1840,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1835
1840
Rvalue :: ShallowInitBox ( operand, ty) => {
1836
1841
self . check_operand ( operand, location) ;
1837
1842
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] ) ;
1839
1844
1840
1845
self . prove_trait_ref (
1841
1846
trait_ref,
@@ -1932,9 +1937,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1932
1937
1933
1938
CastKind :: Pointer ( PointerCast :: Unsize ) => {
1934
1939
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
+ ) ;
1938
1945
1939
1946
self . prove_trait_ref (
1940
1947
trait_ref,
0 commit comments