File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,25 @@ match x {
168
168
```
169
169
"## ,
170
170
171
+ E0013 : r##"
172
+ Static and const variables can refer to other const variables. But a const
173
+ variable cannot refer to a static variable. For example, `Y` cannot refer to `X`
174
+ here:
175
+
176
+ ```
177
+ static X: i32 = 42;
178
+ const Y: i32 = X;
179
+ ```
180
+
181
+ To fix this, the value can be extracted as a const and then used:
182
+
183
+ ```
184
+ const A: i32 = 42;
185
+ static X: i32 = A;
186
+ const Y: i32 = A;
187
+ ```
188
+ "## ,
189
+
171
190
E0015 : r##"
172
191
The only function calls allowed in static or constant expressions are enum
173
192
variant constructors or struct constructors (for unit or tuple structs). This
@@ -462,7 +481,6 @@ register_diagnostics! {
462
481
E0010 ,
463
482
E0011 ,
464
483
E0012 ,
465
- E0013 ,
466
484
E0014 ,
467
485
E0016 ,
468
486
E0017 ,
You can’t perform that action at this time.
0 commit comments