fix overflow in array length computation
This commit is contained in:
parent
a517049d8c
commit
6672b862c4
@ -643,15 +643,15 @@ fn check_must_not_suspend_ty<'tcx>(
|
||||
}
|
||||
ty::Array(ty, len) => {
|
||||
let descr_pre = &format!("{}array{} of ", data.descr_pre, plural_suffix);
|
||||
let target_usize = len.try_eval_target_usize(fcx.tcx, fcx.param_env).unwrap_or(0) as usize;
|
||||
let plural_len = target_usize.saturating_add(1);
|
||||
check_must_not_suspend_ty(
|
||||
fcx,
|
||||
ty,
|
||||
hir_id,
|
||||
SuspendCheckData {
|
||||
descr_pre,
|
||||
plural_len: len.try_eval_target_usize(fcx.tcx, fcx.param_env).unwrap_or(0)
|
||||
as usize
|
||||
+ 1,
|
||||
plural_len,
|
||||
..data
|
||||
},
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user