]> git.lizzy.rs Git - rust.git/blob - src/test/ui/repeat_count.rs
Auto merge of #62748 - luca-barbieri:optimize-refcell-borrow, r=RalfJung
[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 type `usize`
10     //~| found type `()`
11     //~| expected usize, found ()
12     let c = [0; true];
13     //~^ ERROR mismatched types
14     //~| expected usize, found bool
15     let d = [0; 0.5];
16     //~^ ERROR mismatched types
17     //~| expected type `usize`
18     //~| found type `{float}`
19     //~| expected usize, found floating-point number
20     let e = [0; "foo"];
21     //~^ ERROR mismatched types
22     //~| expected type `usize`
23     //~| found type `&'static str`
24     //~| expected usize, found reference
25     let f = [0; -4_isize];
26     //~^ ERROR mismatched types
27     //~| expected usize, found isize
28     let f = [0_usize; -1_isize];
29     //~^ ERROR mismatched types
30     //~| expected usize, found isize
31     struct G {
32         g: (),
33     }
34     let g = [0; G { g: () }];
35     //~^ ERROR mismatched types
36     //~| expected type `usize`
37     //~| found type `main::G`
38     //~| expected usize, found struct `main::G`
39 }