]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/issue-91560.rs
Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errors
[rust.git] / tests / ui / consts / issue-91560.rs
1 // Regression test for issue #91560.
2
3 // run-rustfix
4
5 #![allow(unused,non_upper_case_globals)]
6
7 fn foo() {
8     let mut length: usize = 2;
9     //~^ HELP: consider using `const`
10     let arr = [0; length];
11     //~^ ERROR: attempt to use a non-constant value in a constant [E0435]
12 }
13
14 fn bar() {
15     let   length: usize = 2;
16     //~^ HELP: consider using `const`
17     let arr = [0; length];
18     //~^ ERROR: attempt to use a non-constant value in a constant [E0435]
19 }
20
21 fn main() {}