-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onT-MIRType: This lint will require working with the MIRType: This lint will require working with the MIRT-middleType: Probably requires verifiying typesType: Probably requires verifiying types
Description
This comes from a code reduction, so it's reasonable in its original context:
#![allow(unused_variables)]
fn main() {
const N: usize = 1_000;
let data = [0, 0, 0, 0];
if N <= 4 {
let result = data[N - 1];
}
}
error: index out of bounds: the len is 4 but the index is 999
--> src/main.rs:6:22
|
6 | let result = data[N - 1];
| ^^^^^^^^^^^
|
= note: #[deny(const_err)] on by default
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onT-MIRType: This lint will require working with the MIRType: This lint will require working with the MIRT-middleType: Probably requires verifiying typesType: Probably requires verifiying types