summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/issue-91560.rs
blob: 04592feb505416f2c2baa6ad8a77966cdf213398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Regression test for issue #91560.

// run-rustfix

#![allow(unused,non_upper_case_globals)]

fn foo() {
    let mut length: usize = 2;
    //~^ HELP: consider using `const`
    let arr = [0; length];
    //~^ ERROR: attempt to use a non-constant value in a constant [E0435]
}

fn bar() {
    let   length: usize = 2;
    //~^ HELP: consider using `const`
    let arr = [0; length];
    //~^ ERROR: attempt to use a non-constant value in a constant [E0435]
}

fn main() {}