]> git.lizzy.rs Git - rust.git/commitdiff
Add error explanation for E0013
authorRobin Stocker <robin@nibor.org>
Tue, 28 Apr 2015 09:49:09 +0000 (19:49 +1000)
committerRobin Stocker <robin@nibor.org>
Tue, 28 Apr 2015 10:46:24 +0000 (20:46 +1000)
src/librustc/diagnostics.rs

index 182405a640dbcfb2d506607c6c6194f355c5c06e..8b43f9ada9a3385a6d00554019d608675278195c 100644 (file)
@@ -168,6 +168,25 @@ struct X { 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 @@ enum Method { GET, POST }
     E0010,
     E0011,
     E0012,
-    E0013,
     E0014,
     E0016,
     E0017,