@@ -10,6 +10,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1010use rustc_errors:: struct_span_err;
1111use rustc_hir as hir;
1212use rustc_hir:: def_id:: { DefId , LocalDefId } ;
13+ use rustc_hir:: lang_items:: { CoerceUnsizedTraitLangItem , CopyTraitLangItem , SizedTraitLangItem } ;
1314use rustc_index:: vec:: { Idx , IndexVec } ;
1415use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
1516use rustc_infer:: infer:: outlives:: env:: RegionBoundPairs ;
@@ -502,7 +503,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
502503 if let PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) = context {
503504 let tcx = self . tcx ( ) ;
504505 let trait_ref = ty:: TraitRef {
505- def_id : tcx. lang_items ( ) . copy_trait ( ) . unwrap ( ) ,
506+ def_id : tcx. require_lang_item ( CopyTraitLangItem , None ) ,
506507 substs : tcx. mk_substs_trait ( place_ty. ty , & [ ] ) ,
507508 } ;
508509
@@ -1468,7 +1469,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14681469 self . check_rvalue ( body, rv, location) ;
14691470 if !self . tcx ( ) . features ( ) . unsized_locals {
14701471 let trait_ref = ty:: TraitRef {
1471- def_id : tcx. lang_items ( ) . sized_trait ( ) . unwrap ( ) ,
1472+ def_id : tcx. require_lang_item ( SizedTraitLangItem , None ) ,
14721473 substs : tcx. mk_substs_trait ( place_ty, & [ ] ) ,
14731474 } ;
14741475 self . prove_trait_ref (
@@ -2013,7 +2014,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20132014 ty:: Predicate :: Trait (
20142015 ty:: Binder :: bind ( ty:: TraitPredicate {
20152016 trait_ref : ty:: TraitRef :: new (
2016- self . tcx ( ) . lang_items ( ) . copy_trait ( ) . unwrap ( ) ,
2017+ self . tcx ( )
2018+ . require_lang_item ( CopyTraitLangItem , None ) ,
20172019 tcx. mk_substs_trait ( ty, & [ ] ) ,
20182020 ) ,
20192021 } ) ,
@@ -2037,7 +2039,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20372039 }
20382040
20392041 let trait_ref = ty:: TraitRef {
2040- def_id : tcx. lang_items ( ) . sized_trait ( ) . unwrap ( ) ,
2042+ def_id : tcx. require_lang_item ( SizedTraitLangItem , None ) ,
20412043 substs : tcx. mk_substs_trait ( ty, & [ ] ) ,
20422044 } ;
20432045
@@ -2135,7 +2137,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21352137 CastKind :: Pointer ( PointerCast :: Unsize ) => {
21362138 let & ty = ty;
21372139 let trait_ref = ty:: TraitRef {
2138- def_id : tcx. lang_items ( ) . coerce_unsized_trait ( ) . unwrap ( ) ,
2140+ def_id : tcx. require_lang_item ( CoerceUnsizedTraitLangItem , None ) ,
21392141 substs : tcx. mk_substs_trait ( op. ty ( body, tcx) , & [ ty. into ( ) ] ) ,
21402142 } ;
21412143
0 commit comments