Currently, c2rust transpile translates all statics as static muts. This is still done even when the static in C is marked const. static muts are unsafe to access, so translating them as non-mutstatics would be greatly beneficial. One caveat is that non-mutstatics can't have any raw pointers anywhere inside them, so for those cases, we'll have to keep using a static mut, or possibly replace the raw pointers with Option<&'static _>s, as those raw pointers do have to be known at compile time. But at the very least, the simple static const cases with no raw pointers should be translated as non-mutstatics. This would fix #907, as well as make manual transpilation like in rav1d easier (e.x. https://github.com/memorysafety/rav1d/pull/182/commits/27309d59cff90d889fa7338c3a69ccaad4c0dee4).
Currently,
c2rust transpile
translates allstatic
s asstatic mut
s. This is still done even when thestatic
in C is markedconst
.static mut
s areunsafe
to access, so translating them as non-mut
static
s would be greatly beneficial. One caveat is that non-mut
static
s can't have any raw pointers anywhere inside them, so for those cases, we'll have to keep using astatic mut
, or possibly replace the raw pointers withOption<&'static _>
s, as those raw pointers do have to be known at compile time. But at the very least, the simplestatic const
cases with no raw pointers should be translated as non-mut
static
s. This would fix #907, as well as make manual transpilation like in rav1d easier (e.x. https://github.com/memorysafety/rav1d/pull/182/commits/27309d59cff90d889fa7338c3a69ccaad4c0dee4).