foo<const C: usize>()1 fn foo<const C: usize>() {}
2 
3 const BAR: usize = 42;
4 
a()5 fn a() {
6     foo::<BAR + 3>(); //~ ERROR expected one of
7 }
b()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`
14     //~| ERROR type provided when a constant was expected
15     //~| WARN trait objects without an explicit `dyn` are deprecated
16     //~| WARN this is accepted in the current edition
17 }
c()18 fn c() {
19     foo::<3 + 3>(); //~ ERROR expressions must be enclosed in braces
20 }
d()21 fn d() {
22     foo::<BAR - 3>(); //~ ERROR expected one of
23 }
e()24 fn e() {
25     foo::<BAR - BAR>(); //~ ERROR expected one of
26 }
f()27 fn f() {
28     foo::<100 - BAR>(); //~ ERROR expressions must be enclosed in braces
29 }
g()30 fn g() {
31     foo::<bar<i32>()>(); //~ ERROR expected one of
32 }
h()33 fn h() {
34     foo::<bar::<i32>()>(); //~ ERROR expected one of
35 }
i()36 fn i() {
37     foo::<bar::<i32>() + BAR>(); //~ ERROR expected one of
38 }
j()39 fn j() {
40     foo::<bar::<i32>() - BAR>(); //~ ERROR expected one of
41 }
k()42 fn k() {
43     foo::<BAR - bar::<i32>()>(); //~ ERROR expected one of
44 }
l()45 fn l() {
46     foo::<BAR - bar::<i32>()>(); //~ ERROR expected one of
47 }
48 
bar<const C: usize>() -> usize49 const fn bar<const C: usize>() -> usize {
50     C
51 }
52 
main()53 fn main() {}
54