diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc1d6f1..cf2093f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ 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. + ## [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..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 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