diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-06-19 14:03:07 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-06-19 14:03:07 +0200 |
| commit | 6471dccd3b3a5b83b4fccecffc94047e1086ca2f (patch) | |
| tree | b88d7fad08da31b9cfbd2676239a7847625402a0 /src | |
| parent | 8c5572fc2114fa2e8156c89cda89c799c9c3e9e0 (diff) | |
| download | rust-6471dccd3b3a5b83b4fccecffc94047e1086ca2f.tar.gz rust-6471dccd3b3a5b83b4fccecffc94047e1086ca2f.zip | |
Add E0016 explanation
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/diagnostics.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 0857fb3258e..124117ca80b 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -256,6 +256,21 @@ See [RFC 911] for more details on the design of `const fn`s. [RFC 911]: https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md "##, +E0016: r##" +Blocks in constants may only contain items (such as constant, function +definition, etc...) and a tail expression. Example: + +``` +const FOO: i32 = { let x = 0; x }; // 'x' isn't an item! +``` + +To avoid it, you have to replace the non-item object: + +``` +const FOO: i32 = { const X : i32 = 0; X }; +``` +"##, + E0018: r##" The value of static and const variables must be known at compile time. You can't cast a pointer as an integer because we can't know what value the |
