1
Fork 0

Properly check that array length is valid type during built-in unsizing in index

This commit is contained in:
Michael Goulet 2025-01-28 17:52:28 +00:00
parent fdd1a3b026
commit 7e68422859
13 changed files with 63 additions and 9 deletions

View file

@ -2770,6 +2770,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
ObligationCauseCode::SliceOrArrayElem => {
err.note("slice and array elements must have `Sized` type");
}
ObligationCauseCode::ArrayLen(array_ty) => {
err.note(format!("the length of array `{array_ty}` must be type `usize`"));
}
ObligationCauseCode::TupleElem => {
err.note("only the last element of a tuple may have a dynamically sized type");
}