@@ -1253,7 +1253,7 @@ fn is_end_eq_array_len<'tcx>(
1253
1253
if let ExprKind :: Lit ( ref lit) = end. node;
1254
1254
if let ast:: LitKind :: Int ( end_int, _) = lit. node;
1255
1255
if let ty:: Array ( _, arr_len_const) = indexed_ty. sty;
1256
- if let Some ( arr_len) = arr_len_const. assert_usize ( cx. tcx) ;
1256
+ if let Some ( arr_len) = arr_len_const. try_eval_usize ( cx. tcx, cx . param_env ) ;
1257
1257
then {
1258
1258
return match limits {
1259
1259
ast:: RangeLimits :: Closed => end_int + 1 >= arr_len. into( ) ,
@@ -1375,7 +1375,7 @@ fn check_for_loop_arg(cx: &LateContext<'_, '_>, pat: &Pat, arg: &Expr, expr: &Ex
1375
1375
match cx. tables . expr_ty ( & args[ 0 ] ) . sty {
1376
1376
// If the length is greater than 32 no traits are implemented for array and
1377
1377
// therefore we cannot use `&`.
1378
- ty:: Array ( _, size) if size. assert_usize ( cx. tcx ) . expect ( "array size" ) > 32 => ( ) ,
1378
+ ty:: Array ( _, size) if size. eval_usize ( cx. tcx , cx . param_env ) > 32 => { } ,
1379
1379
_ => lint_iter_method ( cx, args, arg, method_name) ,
1380
1380
} ;
1381
1381
} else {
@@ -1988,7 +1988,7 @@ fn is_ref_iterable_type(cx: &LateContext<'_, '_>, e: &Expr) -> bool {
1988
1988
fn is_iterable_array < ' tcx > ( ty : Ty < ' tcx > , cx : & LateContext < ' _ , ' tcx > ) -> bool {
1989
1989
// IntoIterator is currently only implemented for array sizes <= 32 in rustc
1990
1990
match ty. sty {
1991
- ty:: Array ( _, n) => ( 0 ..=32 ) . contains ( & n. assert_usize ( cx. tcx ) . expect ( "array length" ) ) ,
1991
+ ty:: Array ( _, n) => ( 0 ..=32 ) . contains ( & n. eval_usize ( cx. tcx , cx . param_env ) ) ,
1992
1992
_ => false ,
1993
1993
}
1994
1994
}
0 commit comments