@@ -532,8 +532,11 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
532532
533533 if let PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) = context {
534534 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+ ) ;
537540
538541 // To have a `Copy` operand, the type `T` of the
539542 // value must be `Copy`. Note that we prove that `T: Copy`,
@@ -1273,10 +1276,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12731276
12741277 self . check_rvalue ( body, rv, location) ;
12751278 if !self . unsized_feature_enabled ( ) {
1276- let trait_ref = ty:: TraitRef :: from_lang_item (
1279+ let trait_ref = ty:: TraitRef :: new (
12771280 tcx,
1278- LangItem :: Sized ,
1279- self . last_span ,
1281+ tcx. require_lang_item ( LangItem :: Sized , Some ( self . last_span ) ) ,
12801282 [ place_ty] ,
12811283 ) ;
12821284 self . prove_trait_ref (
@@ -1925,8 +1927,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19251927 Operand :: Move ( place) => {
19261928 // Make sure that repeated elements implement `Copy`.
19271929 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+ ) ;
19301935
19311936 self . prove_trait_ref (
19321937 trait_ref,
@@ -1939,7 +1944,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19391944 }
19401945
19411946 & 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+ ) ;
19431952
19441953 self . prove_trait_ref (
19451954 trait_ref,
@@ -1952,7 +1961,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19521961 Rvalue :: ShallowInitBox ( operand, ty) => {
19531962 self . check_operand ( operand, location) ;
19541963
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+ ) ;
19561969
19571970 self . prove_trait_ref (
19581971 trait_ref,
@@ -2050,10 +2063,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20502063
20512064 CastKind :: PointerCoercion ( PointerCoercion :: Unsize ) => {
20522065 let & ty = ty;
2053- let trait_ref = ty:: TraitRef :: from_lang_item (
2066+ let trait_ref = ty:: TraitRef :: new (
20542067 tcx,
2055- LangItem :: CoerceUnsized ,
2056- span,
2068+ tcx. require_lang_item ( LangItem :: CoerceUnsized , Some ( span) ) ,
20572069 [ op. ty ( body, tcx) , ty] ,
20582070 ) ;
20592071
0 commit comments