Closed spernsteiner closed 1 year ago
We do this if we see no writes to the static in the program. Types that don't admit writes are Sync
, so it would be preferable (and sufficient to enable compilation) to change the type and rewrite use sites to match:
static FOO: Option<&mut u8> = None;
But we don't at present rewrite pointer types for statics, which seems like the right way to fix this.
@spernsteiner would one temporary solution be to mark these FIXED
to address other more fundamental forms of rewritten-code compilation errors, and then come back to this?
is this a duplicate of #907?
Closing as a duplicate of #907
Input:
We currently remove the
mut
, producing the following output:However, this results in a compile error:
*mut u8
is notSync
, so it can't be used as the type of a non-mut static. Note that mutable statics are exempt from this check, so the input code does not trigger a compile error.