You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One other instance that the constant evaluation will reject is any attempt to read values behind a `static` item declared in an [`extern`] block, even though the item is not marked as `mut`.
95
+
Computing the address to the `static` item is still permitted. However, as soon as a use or dereferencing of the whole or a part of the `static` item constitutes a read access which will fail the constant evaluation.
96
+
97
+
```rust,edition2021,compile_fail,E0080
98
+
extern {
99
+
static S: u32;
100
+
}
101
+
102
+
const C: u32 = unsafe { S };
103
+
```
104
+
94
105
## Const Functions
95
106
96
107
A _const fn_ is a function that one is permitted to call from a const context. Declaring a function
@@ -126,6 +137,7 @@ of whether you are building on a `64` bit or a `32` bit system.
0 commit comments