Properly check that array length is valid type during built-in unsizing in index
This commit is contained in:
parent
fdd1a3b026
commit
7e68422859
13 changed files with 63 additions and 9 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue