Fix tuple_array_conversions lint on nightly

This commit is contained in:
Igor Aleksanov 2023-08-22 13:15:05 +04:00
parent fc1152abf6
commit e35eb91a33

View File

@ -189,8 +189,8 @@ fn all_bindings_are_for_conv<'tcx>(
tys.len() == elements.len() && tys.iter().chain(final_tys.iter().copied()).all_equal()
},
(ToType::Tuple, ty::Array(ty, len)) => {
len.eval_target_usize(cx.tcx, cx.param_env) as usize == elements.len()
&& final_tys.iter().chain(once(ty)).all_equal()
let Some(len) = len.try_eval_target_usize(cx.tcx, cx.param_env) else { return false };
len as usize == elements.len() && final_tys.iter().chain(once(ty)).all_equal()
},
_ => false,
}