@@ -532,8 +532,11 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
532
532
533
533
if let PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) = context {
534
534
let tcx = self . tcx ( ) ;
535
- let trait_ref =
536
- ty:: TraitRef :: from_lang_item ( tcx, LangItem :: Copy , self . last_span , [ place_ty. ty ] ) ;
535
+ let trait_ref = ty:: TraitRef :: new (
536
+ tcx,
537
+ tcx. require_lang_item ( LangItem :: Copy , Some ( self . last_span ) ) ,
538
+ [ place_ty. ty ] ,
539
+ ) ;
537
540
538
541
// To have a `Copy` operand, the type `T` of the
539
542
// value must be `Copy`. Note that we prove that `T: Copy`,
@@ -1273,10 +1276,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1273
1276
1274
1277
self . check_rvalue ( body, rv, location) ;
1275
1278
if !self . unsized_feature_enabled ( ) {
1276
- let trait_ref = ty:: TraitRef :: from_lang_item (
1279
+ let trait_ref = ty:: TraitRef :: new (
1277
1280
tcx,
1278
- LangItem :: Sized ,
1279
- self . last_span ,
1281
+ tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
1280
1282
[ place_ty] ,
1281
1283
) ;
1282
1284
self . prove_trait_ref (
@@ -1925,8 +1927,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1925
1927
Operand :: Move ( place) => {
1926
1928
// Make sure that repeated elements implement `Copy`.
1927
1929
let ty = place. ty ( body, tcx) . ty ;
1928
- let trait_ref =
1929
- ty:: TraitRef :: from_lang_item ( tcx, LangItem :: Copy , span, [ ty] ) ;
1930
+ let trait_ref = ty:: TraitRef :: new (
1931
+ tcx,
1932
+ tcx. require_lang_item ( LangItem :: Copy , Some ( span) ) ,
1933
+ [ ty] ,
1934
+ ) ;
1930
1935
1931
1936
self . prove_trait_ref (
1932
1937
trait_ref,
@@ -1939,7 +1944,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1939
1944
}
1940
1945
1941
1946
& Rvalue :: NullaryOp ( NullOp :: SizeOf | NullOp :: AlignOf , ty) => {
1942
- let trait_ref = ty:: TraitRef :: from_lang_item ( tcx, LangItem :: Sized , span, [ ty] ) ;
1947
+ let trait_ref = ty:: TraitRef :: new (
1948
+ tcx,
1949
+ tcx. require_lang_item ( LangItem :: Sized , Some ( span) ) ,
1950
+ [ ty] ,
1951
+ ) ;
1943
1952
1944
1953
self . prove_trait_ref (
1945
1954
trait_ref,
@@ -1952,7 +1961,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1952
1961
Rvalue :: ShallowInitBox ( operand, ty) => {
1953
1962
self . check_operand ( operand, location) ;
1954
1963
1955
- let trait_ref = ty:: TraitRef :: from_lang_item ( tcx, LangItem :: Sized , span, [ * ty] ) ;
1964
+ let trait_ref = ty:: TraitRef :: new (
1965
+ tcx,
1966
+ tcx. require_lang_item ( LangItem :: Sized , Some ( span) ) ,
1967
+ [ * ty] ,
1968
+ ) ;
1956
1969
1957
1970
self . prove_trait_ref (
1958
1971
trait_ref,
@@ -2050,10 +2063,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2050
2063
2051
2064
CastKind :: PointerCoercion ( PointerCoercion :: Unsize ) => {
2052
2065
let & ty = ty;
2053
- let trait_ref = ty:: TraitRef :: from_lang_item (
2066
+ let trait_ref = ty:: TraitRef :: new (
2054
2067
tcx,
2055
- LangItem :: CoerceUnsized ,
2056
- span,
2068
+ tcx. require_lang_item ( LangItem :: CoerceUnsized , Some ( span) ) ,
2057
2069
[ op. ty ( body, tcx) , ty] ,
2058
2070
) ;
2059
2071
0 commit comments