Closed
Description
This lint currently prints
= note: reference of mutable static is a hard error from 2024 edition
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
The first line seems grammatically not entirely right to me. Shouldn't it say "in the 2024 edition"? And should it be "reference of" or "reference to"?
The second line doesn't quite capture the problem IMO. The issue is that the reference has lifetime 'static
, so
- a mutable reference supposedly lives forever, so creating more than one is very dangerous and they can accidentally be used in overlapping ways
- a shared reference supposedly lives forever, so if there is ever also a mutable reference created that is very dangerous as they can accidentally be used in overlapping ways
Cc @obeis