]> git.lizzy.rs Git - rust.git/blob - src/test/ui/repeat_count.rs
Rollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC
[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     struct G {
26         g: (),
27     }
28     let g = [0; G { g: () }];
29     //~^ ERROR mismatched types
30     //~| expected `usize`, found struct `main::G`
31 }