Skip to content

Commit a2b38e8

Browse files
authored
Add note about mutability to external statics
1 parent 3ca161c commit a2b38e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/items/external-blocks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ of initializing the static.
6666

6767
Extern statics can be either immutable or mutable just like [statics] outside of external blocks.
6868
An immutable static *must* be initialized before any Rust code is executed. It is not enough for
69-
the static to be initialized before Rust code reads from it.
69+
the static to be initialized before Rust code reads from it. Mutating a non-`mut`,
70+
non-interior-`mut` external static is undefined behavior, even if that mutation happens by non-Rust
71+
code.
7072

7173
## ABI
7274

0 commit comments

Comments
 (0)