summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs
blob: f20a0ede1137cb76a6aab1b362be07ef25e2179e (plain)
1
2
3
4
5
6
7
8
9
10
11
#![warn(clippy::out_of_bounds_indexing)]
#![allow(clippy::no_effect, const_err)]

fn main() {
    let x = [1, 2, 3, 4];

    // issue 3102
    let num = 1;
    &x[num..10]; // should trigger out of bounds error
    &x[10..num]; // should trigger out of bounds error
}