]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/bad-const-generic-exprs.rs
Auto merge of #106143 - matthiaskrgr:rollup-3kpy1dc, r=matthiaskrgr
[rust.git] / src / test / ui / const-generics / bad-const-generic-exprs.rs
1 struct Wow<const N: usize>;
2
3 fn main() {
4     let _: Wow<if true {}>;
5     //~^ ERROR invalid const generic expression
6     //~| HELP expressions must be enclosed in braces to be used as const generic arguments
7     let _: Wow<|| ()>;
8     //~^ ERROR invalid const generic expression
9     //~| HELP expressions must be enclosed in braces to be used as const generic arguments
10     let _: Wow<A.b>;
11     //~^ ERROR expected one of
12     //~| HELP expressions must be enclosed in braces to be used as const generic arguments
13     let _: Wow<A.0>;
14     //~^ ERROR expected one of
15     //~| HELP expressions must be enclosed in braces to be used as const generic arguments
16
17     // FIXME(compiler-errors): This one is still unsatisfying,
18     // and probably a case I could see someone typing by accident..
19     let _: Wow<[12]>;
20     //~^ ERROR expected type, found
21     //~| ERROR type provided when a constant was expected
22 }