]> git.lizzy.rs Git - rust.git/commitdiff
Add E0016 explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 19 Jun 2015 12:03:07 +0000 (14:03 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 19 Jun 2015 12:03:07 +0000 (14:03 +0200)
src/librustc/diagnostics.rs

index 0857fb3258eec7452ab6a923f859c4d95bbf1b7e..124117ca80bcd7e8e4e52e831996c82151bc44c4 100644 (file)
@@ -256,6 +256,21 @@ fn index<'a>(&'a self, idx: u8) -> &'a u8 { &self.a }
 [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