On nightly beta, the static_mut_refs lint defaults to warn. With some of our examples using #[deny(warnings)], this leads to the following error:
error: creating a mutable reference to mutable static is discouraged
--> cortex-m-rt/examples/entry-static.rs:15:16
|
15 | static mut COUNT: u32 = 0;
| ^^^^^ mutable reference to mutable static
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
= note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
On
nightlybeta, the static_mut_refs lint defaults to warn. With some of our examples using#[deny(warnings)]
, this leads to the following error:With edition 2024, the lint will probably default to deny. (https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html)
To avoid that, set #[allow(static_mut_refs)] locally in the macro expansion.
This only silences the warning and doesn't answer the underlying question if we want to do that transform at all. See eg. https://github.com/rust-embedded/cortex-m/issues/411 for discussion.