File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1- Static and const variables can refer to other const variables. But a const
2- variable cannot refer to a thread-local static variable.
1+ A compile-time const variable is referring to a thread-local static variable.
32
43Erroneous code example:
54
@@ -12,8 +11,10 @@ static X: usize = 12;
1211const Y: usize = 2 * X;
1312```
1413
15- In this example, ` Y ` cannot refer to ` X ` . To fix this, the value can be
16- extracted as a const and then used:
14+ Static and const variables can refer to other const variables but a const
15+ variable cannot refer to a thread-local static variable. In this example,
16+ ` Y ` cannot refer to ` X ` . To fix this, the value can be extracted as a const
17+ and then used:
1718
1819```
1920#![feature(thread_local)]
You can’t perform that action at this time.
0 commit comments