rusticl: work around reference-to-mutable-static warnings
What does this MR do and why?
Fixes a build warning:
warning: creating a mutable reference to mutable static is discouraged
--> ../src/gallium/frontends/rusticl/core/platform.rs:76:26
|
76 | let debug = unsafe { &mut PLATFORM_DBG };
| ^^^^^^^^^^^^^^^^^ mutable reference to mutable static
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
= note: `#[warn(static_mut_refs)]` on by default help: use `addr_of_mut!` instead to create a raw pointer
|
76 | let debug = unsafe { addr_of_mut!(PLATFORM_DBG) };
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
and others like it, by taking a detour through a raw pointer via the addr_of_mut!
or addr_of!
macros.
For details, see: https://github.com/rust-lang/rust/issues/114447 where this is suggested to be fine, as long as the mutable reference stops being used before a second reference is created.