@@ -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, LangItem :: Copy , self . last_span , [ 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,12 @@ 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,
1243
+ LangItem :: Sized ,
1244
+ self . last_span ,
1245
+ [ place_ty] ,
1246
+ ) ;
1242
1247
self . prove_trait_ref (
1243
1248
trait_ref,
1244
1249
location. to_locations ( ) ,
@@ -1810,7 +1815,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1810
1815
Operand :: Move ( place) => {
1811
1816
// Make sure that repeated elements implement `Copy`.
1812
1817
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] ) ;
1814
1820
1815
1821
self . prove_trait_ref (
1816
1822
trait_ref,
@@ -1823,7 +1829,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1823
1829
}
1824
1830
1825
1831
& 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] ) ;
1827
1833
1828
1834
self . prove_trait_ref (
1829
1835
trait_ref,
@@ -1835,7 +1841,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1835
1841
Rvalue :: ShallowInitBox ( operand, ty) => {
1836
1842
self . check_operand ( operand, location) ;
1837
1843
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] ) ;
1839
1845
1840
1846
self . prove_trait_ref (
1841
1847
trait_ref,
@@ -1932,9 +1938,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1932
1938
1933
1939
CastKind :: Pointer ( PointerCast :: Unsize ) => {
1934
1940
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
+ ) ;
1938
1947
1939
1948
self . prove_trait_ref (
1940
1949
trait_ref,
0 commit comments