From e7ca4fbb3d8a80b2d65dbe005909cb1fc77f028a Mon Sep 17 00:00:00 2001 From: Kurtis Dinelle Date: Sat, 20 Sep 2025 13:13:57 -0700 Subject: [PATCH 1/2] Add unsafe block around DEVICE_PERIPHERALS --- CHANGELOG.md | 3 +++ src/generate/device.rs | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc1d6f1..991ff65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +- Add unsafe block around `DEVICE_PERIPHERALS = true` in `Peripherals::steal()` + to support Rust 2024 edition. + ## [v0.37.0] - 2025-08-14 - Fix new `mismatched-lifetime-syntaxes` lint warnings diff --git a/src/generate/device.rs b/src/generate/device.rs index e21d249d..864437c5 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -301,6 +301,12 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result= RustEdition::E2024 { + quote!(unsafe { DEVICE_PERIPHERALS = true }) + } else { + quote!(DEVICE_PERIPHERALS = true;) + }; + out.extend(quote! { // NOTE `no_mangle` is used here to prevent linking different minor versions of the device // crate as that would let you `take` the device peripherals more than once (one per minor @@ -339,7 +345,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result Self { - DEVICE_PERIPHERALS = true; + #set_device_peripherals_true Peripherals { #exprs From a5ecffa1b9dc9ff7ecbba573aa0f4c3554768d05 Mon Sep 17 00:00:00 2001 From: Kurtis Dinelle Date: Wed, 1 Oct 2025 22:23:58 -0700 Subject: [PATCH 2/2] Use doc_cfg to allow nightly docs to build --- CHANGELOG.md | 1 + src/generate/device.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 991ff65f..cf2093f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +- Change `feature(doc_auto_cfg)` to `feature(doc_cfg)` to allow nightly docs to build. - Add unsafe block around `DEVICE_PERIPHERALS = true` in `Peripherals::steal()` to support Rust 2024 edition. diff --git a/src/generate/device.rs b/src/generate/device.rs index 864437c5..ddd57359 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -59,7 +59,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result