@@ -9,8 +9,20 @@ help: to write a `const` expression, surround it with braces for it to be unambi
9
9
LL | foo::<{ BAR + 3 }>();
10
10
| ^ ^
11
11
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
+
12
24
error: expected one of `,` or `>`, found `-`
13
- --> $DIR/const-expression-missing-braces.rs:20 :15
25
+ --> $DIR/const-expression-missing-braces.rs:18 :15
14
26
|
15
27
LL | foo::<BAR - 3>();
16
28
| ^ expected one of `,` or `>`
@@ -21,7 +33,7 @@ LL | foo::<{ BAR - 3 }>();
21
33
| ^ ^
22
34
23
35
error: expected one of `,` or `>`, found `-`
24
- --> $DIR/const-expression-missing-braces.rs:24 :15
36
+ --> $DIR/const-expression-missing-braces.rs:21 :15
25
37
|
26
38
LL | foo::<BAR - BAR>();
27
39
| ^ expected one of `,` or `>`
@@ -31,8 +43,20 @@ help: to write a `const` expression, surround it with braces for it to be unambi
31
43
LL | foo::<{ BAR - BAR }>();
32
44
| ^ ^
33
45
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
+
34
58
error: expected one of `,` or `>`, found `(`
35
- --> $DIR/const-expression-missing-braces.rs:31 :19
59
+ --> $DIR/const-expression-missing-braces.rs:27 :19
36
60
|
37
61
LL | foo::<bar<i32>()>();
38
62
| ^ expected one of `,` or `>`
@@ -43,7 +67,7 @@ LL | foo::<{ bar<i32>() }>();
43
67
| ^ ^
44
68
45
69
error: expected one of `,` or `>`, found `(`
46
- --> $DIR/const-expression-missing-braces.rs:34 :21
70
+ --> $DIR/const-expression-missing-braces.rs:30 :21
47
71
|
48
72
LL | foo::<bar::<i32>()>();
49
73
| ^ expected one of `,` or `>`
@@ -54,7 +78,7 @@ LL | foo::<{ bar::<i32>() }>();
54
78
| ^ ^
55
79
56
80
error: expected one of `,` or `>`, found `(`
57
- --> $DIR/const-expression-missing-braces.rs:37 :21
81
+ --> $DIR/const-expression-missing-braces.rs:33 :21
58
82
|
59
83
LL | foo::<bar::<i32>() + BAR>();
60
84
| ^ expected one of `,` or `>`
@@ -65,7 +89,7 @@ LL | foo::<{ bar::<i32>() + BAR }>();
65
89
| ^ ^
66
90
67
91
error: expected one of `,` or `>`, found `(`
68
- --> $DIR/const-expression-missing-braces.rs:40 :21
92
+ --> $DIR/const-expression-missing-braces.rs:36 :21
69
93
|
70
94
LL | foo::<bar::<i32>() - BAR>();
71
95
| ^ expected one of `,` or `>`
@@ -76,7 +100,7 @@ LL | foo::<{ bar::<i32>() - BAR }>();
76
100
| ^ ^
77
101
78
102
error: expected one of `,` or `>`, found `-`
79
- --> $DIR/const-expression-missing-braces.rs:43 :15
103
+ --> $DIR/const-expression-missing-braces.rs:39 :15
80
104
|
81
105
LL | foo::<BAR - bar::<i32>()>();
82
106
| ^ expected one of `,` or `>`
@@ -87,7 +111,7 @@ LL | foo::<{ BAR - bar::<i32>() }>();
87
111
| ^ ^
88
112
89
113
error: expected one of `,` or `>`, found `-`
90
- --> $DIR/const-expression-missing-braces.rs:46 :15
114
+ --> $DIR/const-expression-missing-braces.rs:42 :15
91
115
|
92
116
LL | foo::<BAR - bar::<i32>()>();
93
117
| ^ expected one of `,` or `>`
@@ -98,7 +122,7 @@ LL | foo::<{ BAR - bar::<i32>() }>();
98
122
| ^ ^
99
123
100
124
error: 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
102
126
|
103
127
LL | foo::<BAR + BAR>();
104
128
| ^^^^^^^^^ 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
108
132
LL | foo::<{ BAR + BAR }>();
109
133
| ^ ^
110
134
111
- error: aborting due to 10 previous errors
135
+ error: aborting due to 12 previous errors
112
136
0 commit comments