]> git.lizzy.rs Git - rust.git/blob - src/test/ui/repeat_count.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / repeat_count.rs
1 // Regression test for issue #3645
2
3 fn main() {
4     let n = 1;
5     let a = [0; n];
6     //~^ ERROR attempt to use a non-constant value in a constant [E0435]
7     let b = [0; ()];
8     //~^ ERROR mismatched types
9     //~| expected `usize`, found `()`
10     let c = [0; true];
11     //~^ ERROR mismatched types
12     //~| expected `usize`, found `bool`
13     let d = [0; 0.5];
14     //~^ ERROR mismatched types
15     //~| expected `usize`, found floating-point number
16     let e = [0; "foo"];
17     //~^ ERROR mismatched types
18     //~| expected `usize`, found `&str`
19     let f = [0; -4_isize];
20     //~^ ERROR mismatched types
21     //~| expected `usize`, found `isize`
22     let f = [0_usize; -1_isize];
23     //~^ ERROR mismatched types
24     //~| expected `usize`, found `isize`
25     let f = [0; 4u8];
26     //~^ ERROR mismatched types
27     //~| expected `usize`, found `u8`
28     struct G {
29         g: (),
30     }
31     let g = [0; G { g: () }];
32     //~^ ERROR mismatched types
33     //~| expected `usize`, found struct `main::G`
34 }