@@ -11,7 +11,6 @@ use rustc_hir::def::{CtorKind, DefKind, Res};
11
11
use rustc_hir:: pat_util:: EnumerateAndAdjustIterator ;
12
12
use rustc_hir:: { self as hir, BindingMode , ByRef , HirId , LangItem , Mutability , Pat , PatKind } ;
13
13
use rustc_infer:: infer;
14
- use rustc_middle:: mir:: interpret:: ErrorHandled ;
15
14
use rustc_middle:: ty:: { self , Ty , TypeVisitableExt } ;
16
15
use rustc_middle:: { bug, span_bug} ;
17
16
use rustc_session:: lint:: builtin:: NON_EXHAUSTIVE_OMITTED_PATTERNS ;
@@ -2413,17 +2412,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2413
2412
len : ty:: Const < ' tcx > ,
2414
2413
min_len : u64 ,
2415
2414
) -> ( Option < Ty < ' tcx > > , Ty < ' tcx > ) {
2416
- let len = match len. eval ( self . tcx , self . param_env , span) {
2417
- Ok ( ( _, val) ) => val
2418
- . try_to_scalar ( )
2419
- . and_then ( |scalar| scalar. try_to_scalar_int ( ) . ok ( ) )
2420
- . map ( |int| int. to_target_usize ( self . tcx ) ) ,
2421
- Err ( ErrorHandled :: Reported ( ..) ) => {
2422
- let guar = self . error_scrutinee_unfixed_length ( span) ;
2423
- return ( Some ( Ty :: new_error ( self . tcx , guar) ) , arr_ty) ;
2424
- }
2425
- Err ( ErrorHandled :: TooGeneric ( ..) ) => None ,
2426
- } ;
2415
+ let len = len. try_eval_target_usize ( self . tcx , self . param_env ) ;
2427
2416
2428
2417
let guar = if let Some ( len) = len {
2429
2418
// Now we know the length...
0 commit comments