]> git.proxmox.com Git - rustc.git/blob - tests/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / const-generics / min_const_generics / const-expression-suggest-missing-braces-without-turbofish.rs
1 fn foo<const C: usize>() {}
2
3 const BAR: usize = 42;
4
5 fn a() {
6 foo<BAR + 3>(); //~ ERROR comparison operators cannot be chained
7 }
8 fn b() {
9 foo<BAR + BAR>(); //~ ERROR comparison operators cannot be chained
10 }
11 fn c() {
12 foo<3 + 3>(); //~ ERROR comparison operators cannot be chained
13 }
14 fn d() {
15 foo<BAR - 3>(); //~ ERROR comparison operators cannot be chained
16 }
17 fn e() {
18 foo<BAR - BAR>(); //~ ERROR comparison operators cannot be chained
19 }
20 fn f() {
21 foo<100 - BAR>(); //~ ERROR comparison operators cannot be chained
22 }
23 fn g() {
24 foo<bar<i32>()>(); //~ ERROR comparison operators cannot be chained
25 //~^ ERROR expected one of `;` or `}`, found `>`
26 }
27 fn h() {
28 foo<bar::<i32>()>(); //~ ERROR comparison operators cannot be chained
29 }
30 fn i() {
31 foo<bar::<i32>() + BAR>(); //~ ERROR comparison operators cannot be chained
32 }
33 fn j() {
34 foo<bar::<i32>() - BAR>(); //~ ERROR comparison operators cannot be chained
35 }
36 fn k() {
37 foo<BAR - bar::<i32>()>(); //~ ERROR comparison operators cannot be chained
38 }
39 fn l() {
40 foo<BAR - bar::<i32>()>(); //~ ERROR comparison operators cannot be chained
41 }
42
43 const fn bar<const C: usize>() -> usize {
44 C
45 }
46
47 fn main() {}