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.
3
2
4
3
Erroneous code example:
5
4
@@ -12,8 +11,10 @@ static X: usize = 12;
12
11
const Y: usize = 2 * X;
13
12
```
14
13
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:
17
18
18
19
```
19
20
#![feature(thread_local)]
You can’t perform that action at this time.
0 commit comments