File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,25 @@ const Y: i32 = A;
227
227
```
228
228
"## ,
229
229
230
+ E0014 : r##"
231
+ Constants can only be initialized by a constant value or, in a future
232
+ version of Rust, a call to a const function. This error indicates the use
233
+ of a path (like a::b, or x) denoting something other than one of these
234
+ allowed items. Example:
235
+
236
+ ```
237
+ const FOO: i32 = { let x = 0; x }; // 'x' isn't a constant nor a function!
238
+ ```
239
+
240
+ To avoid it, you have to replace the non-constant value:
241
+
242
+ ```
243
+ const FOO: i32 = { const X : i32 = 0; X };
244
+ // or even:
245
+ const FOO: i32 = { 0 }; // but brackets are useless here
246
+ ```
247
+ "## ,
248
+
230
249
E0015 : r##"
231
250
The only functions that can be called in static or constant expressions are
232
251
`const` functions. Rust currently does not support more general compile-time
@@ -931,7 +950,6 @@ static mut BAR: Option<Vec<i32>> = None;
931
950
932
951
933
952
register_diagnostics ! {
934
- E0014 ,
935
953
E0016 ,
936
954
E0017 ,
937
955
E0019 ,
You can’t perform that action at this time.
0 commit comments