Commit fb688b1
committed
Allow static_mut_refs lint in macro expansions
On nightly, 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
```
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.
#411 for discussion.1 parent 57ce011 commit fb688b1
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
500 | 501 | | |
501 | 502 | | |
502 | 503 | | |
| 504 | + | |
503 | 505 | | |
504 | 506 | | |
505 | 507 | | |
| |||
614 | 616 | | |
615 | 617 | | |
616 | 618 | | |
| 619 | + | |
617 | 620 | | |
618 | 621 | | |
619 | 622 | | |
| |||
0 commit comments