-
Couldn't load subscription status.
- Fork 13.9k
Description
The change for static_mut_refs in the 2024 Edition needs to have documentation (here) for how a user can perform a manual migration.
This documentation should have a more complete explanation of why it is forbidden. Currently it just mentions use in multiple threads, but I don't think that is a complete description.
It also needs to explain to the user how to rewrite their code to make it work. My understanding is that someone can convert &STATIC to &*addr_of!(STATIC), which is equivalent, but still runs afoul of the exact same aliasing problems and undefined behavior, so I don't know if it makes sense to recommend that.
- Why is
&*addr_of!(…)allowed? - What situations are there where
addr_of!is appropriate? - If
addr_of!isn't the correct route, what should a user do to update their code?- Do they have to switch to interior mutability? How? What other options are there?
See also discussion at #114447 and
https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/static_mut_refs