File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,25 @@ match x {
168168```
169169"## ,
170170
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+
171190E0015 : r##"
172191The only function calls allowed in static or constant expressions are enum
173192variant constructors or struct constructors (for unit or tuple structs). This
@@ -462,7 +481,6 @@ register_diagnostics! {
462481 E0010 ,
463482 E0011 ,
464483 E0012 ,
465- E0013 ,
466484 E0014 ,
467485 E0016 ,
468486 E0017 ,
You can’t perform that action at this time.
0 commit comments