]> git.lizzy.rs Git - rust.git/blob - src/test/ui/array-slice-vec/suggest-array-length.rs
Rollup merge of #101529 - mousetail:patch-2, r=thomcc
[rust.git] / src / test / ui / array-slice-vec / suggest-array-length.rs
1 // run-rustfix
2 #![allow(unused_variables, dead_code, non_upper_case_globals)]
3
4 fn main() {
5     const Foo: [i32; _] = [1, 2, 3];
6     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
7     //~| ERROR using `_` for array lengths is unstable
8     const REF_FOO: &[u8; _] = &[1];
9     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
10     //~| ERROR using `_` for array lengths is unstable
11     let foo: [i32; _] = [1, 2, 3];
12     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
13     //~| ERROR using `_` for array lengths is unstable
14     let bar: [i32; _] = [0; 3];
15     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
16     //~| ERROR using `_` for array lengths is unstable
17     let ref_foo: &[i32; _] = &[1, 2, 3];
18     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
19     //~| ERROR using `_` for array lengths is unstable
20     let ref_bar: &[i32; _] = &[0; 3];
21     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
22     //~| ERROR using `_` for array lengths is unstable
23     let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3];
24     //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
25     //~| ERROR using `_` for array lengths is unstable
26 }