File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,21 @@ See [RFC 911] for more details on the design of `const fn`s.
256256[RFC 911]: https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md
257257"## ,
258258
259+ E0016 : r##"
260+ Blocks in constants may only contain items (such as constant, function
261+ definition, etc...) and a tail expression. Example:
262+
263+ ```
264+ const FOO: i32 = { let x = 0; x }; // 'x' isn't an item!
265+ ```
266+
267+ To avoid it, you have to replace the non-item object:
268+
269+ ```
270+ const FOO: i32 = { const X : i32 = 0; X };
271+ ```
272+ "## ,
273+
259274E0018 : r##"
260275The value of static and const variables must be known at compile time. You
261276can't cast a pointer as an integer because we can't know what value the
@@ -950,7 +965,6 @@ static mut BAR: Option<Vec<i32>> = None;
950965
951966
952967register_diagnostics ! {
953- E0016 ,
954968 E0017 ,
955969 E0019 ,
956970 E0022 ,
You can’t perform that action at this time.
0 commit comments