about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2015-04-28 19:49:09 +1000
committerRobin Stocker <robin@nibor.org>2015-04-28 20:46:24 +1000
commit6cdb57d4b6106795014ecb90ec8f90d6e7ffadef (patch)
treef6a4c3a1915031eeaa14d0d0439a03637434008d
parentda2276e293359708b62bb489801cb9872d19d32f (diff)
downloadrust-6cdb57d4b6106795014ecb90ec8f90d6e7ffadef.tar.gz
rust-6cdb57d4b6106795014ecb90ec8f90d6e7ffadef.zip
Add error explanation for E0013
-rw-r--r--src/librustc/diagnostics.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 182405a640d..8b43f9ada9a 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -168,6 +168,25 @@ match x {
 ```
 "##,
 
+E0013: r##"
+Static and const variables can refer to other const variables. But a const
+variable cannot refer to a static variable. For example, `Y` cannot refer to `X`
+here:
+
+```
+static X: i32 = 42;
+const Y: i32 = X;
+```
+
+To fix this, the value can be extracted as a const and then used:
+
+```
+const A: i32 = 42;
+static X: i32 = A;
+const Y: i32 = A;
+```
+"##,
+
 E0015: r##"
 The only function calls allowed in static or constant expressions are enum
 variant constructors or struct constructors (for unit or tuple structs). This
@@ -462,7 +481,6 @@ register_diagnostics! {
     E0010,
     E0011,
     E0012,
-    E0013,
     E0014,
     E0016,
     E0017,