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
The rule is that "mutable references contained within a mutable static
may be referenced in the final value of a constant."
However, the key here is that "mutable static" means either a `static
mut` item or a `static` item with an interior mutable type. We had
made that clear over in `const-eval.const-expr.path-static` but not in
our rules about const item validity, and our link for "mutable static"
had implied it may mean `static mut`.
Let's fix that and add an example to demonstrate the point.
Copy file name to clipboardExpand all lines: src/items/constant-items.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,16 +133,31 @@ const _: U = unsafe { U { f: &mut S }}; // OK.
133
133
// This is treated as a sequence of untyped bytes.
134
134
```
135
135
136
-
Mutable references contained within a [mutable static] may be referenced in the final value of a constant.
136
+
Mutable references contained within a mutable `static` may be referenced in the final value of a constant. A mutable `static` is a [`static mut`] item or a [`static`] item with an [interior mutable] type.
0 commit comments