]>
Commit | Line | Data |
---|---|---|
29967ef6 XL |
1 | fn foo<const C: usize>() {} |
2 | ||
3 | const BAR: usize = 42; | |
4 | ||
5 | fn a() { | |
6 | foo::<BAR + 3>(); //~ ERROR expected one of | |
7 | } | |
8 | fn b() { | |
9 | // FIXME(const_generics): these diagnostics are awful, because trait objects without `dyn` were | |
10 | // a terrible mistake. | |
11 | foo::<BAR + BAR>(); | |
12 | //~^ ERROR expected trait, found constant `BAR` | |
13 | //~| ERROR expected trait, found constant `BAR` | |
fc512014 | 14 | //~| ERROR type provided when a constant was expected |
29967ef6 | 15 | //~| WARN trait objects without an explicit `dyn` are deprecated |
136023e0 | 16 | //~| WARN this is accepted in the current edition |
29967ef6 XL |
17 | } |
18 | fn c() { | |
19 | foo::<3 + 3>(); //~ ERROR expressions must be enclosed in braces | |
20 | } | |
21 | fn d() { | |
22 | foo::<BAR - 3>(); //~ ERROR expected one of | |
23 | } | |
24 | fn e() { | |
25 | foo::<BAR - BAR>(); //~ ERROR expected one of | |
26 | } | |
27 | fn f() { | |
28 | foo::<100 - BAR>(); //~ ERROR expressions must be enclosed in braces | |
29 | } | |
30 | fn g() { | |
31 | foo::<bar<i32>()>(); //~ ERROR expected one of | |
32 | } | |
33 | fn h() { | |
34 | foo::<bar::<i32>()>(); //~ ERROR expected one of | |
35 | } | |
36 | fn i() { | |
37 | foo::<bar::<i32>() + BAR>(); //~ ERROR expected one of | |
38 | } | |
39 | fn j() { | |
40 | foo::<bar::<i32>() - BAR>(); //~ ERROR expected one of | |
41 | } | |
42 | fn k() { | |
43 | foo::<BAR - bar::<i32>()>(); //~ ERROR expected one of | |
44 | } | |
45 | fn l() { | |
46 | foo::<BAR - bar::<i32>()>(); //~ ERROR expected one of | |
47 | } | |
48 | ||
49 | const fn bar<const C: usize>() -> usize { | |
50 | C | |
51 | } | |
52 | ||
53 | fn main() {} |