]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-82566-2.rs
Rollup merge of #106805 - madsravn:master, r=compiler-errors
[rust.git] / tests / ui / suggestions / issue-82566-2.rs
1 struct Foo1<const N1: usize>;
2 struct Foo2<const N1: usize, const N2: usize>;
3 struct Foo3<const N1: usize, const N2: usize, const N3: usize>;
4
5 impl<const N1: usize> Foo1<N1> {
6     const SUM: usize = N1;
7 }
8
9 impl<const N1: usize, const N2: usize> Foo2<N1, N2> {
10     const SUM: usize = N1 + N2;
11 }
12
13 impl<const N1: usize, const N2: usize, const N3: usize> Foo3<N1, N2, N3> {
14     const SUM: usize = N1 + N2 + N3;
15 }
16
17 fn foo1() -> [(); Foo1<10>::SUM] { //~ ERROR: comparison operators cannot be chained
18     todo!()
19 }
20
21 fn foo2() -> [(); Foo2<10, 20>::SUM] {
22     //~^ ERROR: expected one of `.`, `?`, `]`, or an operator, found `,`
23     todo!()
24 }
25
26 fn foo3() -> [(); Foo3<10, 20, 30>::SUM] {
27     //~^ ERROR: expected one of `.`, `?`, `]`, or an operator, found `,`
28     todo!()
29 }
30
31 fn main() {}