@@ -9,8 +9,20 @@ help: to write a `const` expression, surround it with braces for it to be unambi
99LL | foo::<{ BAR + 3 }>();
1010 | ^ ^
1111
12+ error: `const` generic expressions without braces are not supported
13+ --> $DIR/const-expression-missing-braces.rs:15:11
14+ |
15+ LL | foo::<3 + 3>();
16+ | ^^^^^
17+ |
18+ = note: only literals are supported as `const` generic without braces
19+ help: surround `const` expressions with braces
20+ |
21+ LL | foo::<{ 3 + 3 }>();
22+ | ^ ^
23+
1224error: expected one of `,` or `>`, found `-`
13- --> $DIR/const-expression-missing-braces.rs:20 :15
25+ --> $DIR/const-expression-missing-braces.rs:18 :15
1426 |
1527LL | foo::<BAR - 3>();
1628 | ^ expected one of `,` or `>`
@@ -21,7 +33,7 @@ LL | foo::<{ BAR - 3 }>();
2133 | ^ ^
2234
2335error: expected one of `,` or `>`, found `-`
24- --> $DIR/const-expression-missing-braces.rs:24 :15
36+ --> $DIR/const-expression-missing-braces.rs:21 :15
2537 |
2638LL | foo::<BAR - BAR>();
2739 | ^ expected one of `,` or `>`
@@ -31,8 +43,20 @@ help: to write a `const` expression, surround it with braces for it to be unambi
3143LL | foo::<{ BAR - BAR }>();
3244 | ^ ^
3345
46+ error: `const` generic expressions without braces are not supported
47+ --> $DIR/const-expression-missing-braces.rs:24:11
48+ |
49+ LL | foo::<100 - BAR>();
50+ | ^^^^^^^^^
51+ |
52+ = note: only literals are supported as `const` generic without braces
53+ help: surround `const` expressions with braces
54+ |
55+ LL | foo::<{ 100 - BAR }>();
56+ | ^ ^
57+
3458error: expected one of `,` or `>`, found `(`
35- --> $DIR/const-expression-missing-braces.rs:31 :19
59+ --> $DIR/const-expression-missing-braces.rs:27 :19
3660 |
3761LL | foo::<bar<i32>()>();
3862 | ^ expected one of `,` or `>`
@@ -43,7 +67,7 @@ LL | foo::<{ bar<i32>() }>();
4367 | ^ ^
4468
4569error: expected one of `,` or `>`, found `(`
46- --> $DIR/const-expression-missing-braces.rs:34 :21
70+ --> $DIR/const-expression-missing-braces.rs:30 :21
4771 |
4872LL | foo::<bar::<i32>()>();
4973 | ^ expected one of `,` or `>`
@@ -54,7 +78,7 @@ LL | foo::<{ bar::<i32>() }>();
5478 | ^ ^
5579
5680error: expected one of `,` or `>`, found `(`
57- --> $DIR/const-expression-missing-braces.rs:37 :21
81+ --> $DIR/const-expression-missing-braces.rs:33 :21
5882 |
5983LL | foo::<bar::<i32>() + BAR>();
6084 | ^ expected one of `,` or `>`
@@ -65,7 +89,7 @@ LL | foo::<{ bar::<i32>() + BAR }>();
6589 | ^ ^
6690
6791error: expected one of `,` or `>`, found `(`
68- --> $DIR/const-expression-missing-braces.rs:40 :21
92+ --> $DIR/const-expression-missing-braces.rs:36 :21
6993 |
7094LL | foo::<bar::<i32>() - BAR>();
7195 | ^ expected one of `,` or `>`
@@ -76,7 +100,7 @@ LL | foo::<{ bar::<i32>() - BAR }>();
76100 | ^ ^
77101
78102error: expected one of `,` or `>`, found `-`
79- --> $DIR/const-expression-missing-braces.rs:43 :15
103+ --> $DIR/const-expression-missing-braces.rs:39 :15
80104 |
81105LL | foo::<BAR - bar::<i32>()>();
82106 | ^ expected one of `,` or `>`
@@ -87,7 +111,7 @@ LL | foo::<{ BAR - bar::<i32>() }>();
87111 | ^ ^
88112
89113error: expected one of `,` or `>`, found `-`
90- --> $DIR/const-expression-missing-braces.rs:46 :15
114+ --> $DIR/const-expression-missing-braces.rs:42 :15
91115 |
92116LL | foo::<BAR - bar::<i32>()>();
93117 | ^ expected one of `,` or `>`
@@ -98,7 +122,7 @@ LL | foo::<{ BAR - bar::<i32>() }>();
98122 | ^ ^
99123
100124error: likely `const` expression parsed as trait bounds
101- --> $DIR/const-expression-missing-braces.rs:13 :11
125+ --> $DIR/const-expression-missing-braces.rs:12 :11
102126 |
103127LL | foo::<BAR + BAR>();
104128 | ^^^^^^^^^ parsed as trait bounds but traits weren't found
@@ -108,5 +132,5 @@ help: if you meant to write a `const` expression, surround the expression with b
108132LL | foo::<{ BAR + BAR }>();
109133 | ^ ^
110134
111- error: aborting due to 10 previous errors
135+ error: aborting due to 12 previous errors
112136
0 commit comments