File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 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;
227227```
228228"## ,
229229
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+
230249E0015 : r##"
231250The only functions that can be called in static or constant expressions are
232251`const` functions. Rust currently does not support more general compile-time
@@ -931,7 +950,6 @@ static mut BAR: Option<Vec<i32>> = None;
931950
932951
933952register_diagnostics ! {
934- E0014 ,
935953 E0016 ,
936954 E0017 ,
937955 E0019 ,
You can’t perform that action at this time.
0 commit comments