2019-07-16 00:30:23 -05:00
|
|
|
#![warn(clippy::out_of_bounds_indexing)]
|
2022-09-21 06:05:20 -05:00
|
|
|
#![allow(clippy::no_effect)]
|
2019-07-16 00:30:23 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = [1, 2, 3, 4];
|
|
|
|
|
|
|
|
// issue 3102
|
|
|
|
let num = 1;
|
2023-07-28 13:40:44 -05:00
|
|
|
&x[num..10];
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: range is out of bounds
|
|
|
|
//~| NOTE: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
|
2023-07-28 13:40:44 -05:00
|
|
|
&x[10..num];
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: range is out of bounds
|
2019-07-16 00:30:23 -05:00
|
|
|
}
|