Closed
Description
The following output should only emit the error once:
#![warn(const_err)]
fn main() {
&{ [1, 2, 3][4] };
}
error: index out of bounds: the len is 3 but the index is 4
--> $DIR/array-literal-index-oob.rs:2:7
|
LL | &{[1, 2, 3][4]};
| ^^^^^^^^^^^^
|
= note: `#[deny(const_err)]` on by default
error: reaching this expression at runtime will panic or abort
--> $DIR/array-literal-index-oob.rs:2:7
|
LL | &{[1, 2, 3][4]};
| --^^^^^^^^^^^^-
| |
| index out of bounds: the len is 3 but the index is 4
error: aborting due to 2 previous errors
Follow up to #61598
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Too much output caused by a single piece of incorrect code.Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.