From d44a5fa86a75a97acef5321d2e061a914cf8d871 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 16 Jan 2020 23:22:44 +0100 Subject: Use a private field instead of `#[non_exhaustive]` --- src/peripheral/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index c9c8ad6..c84003f 100644 --- a/src/peripheral/mod.rs +++ b/src/peripheral/mod.rs @@ -89,7 +89,6 @@ mod test; /// Core peripherals #[allow(non_snake_case)] -#[non_exhaustive] pub struct Peripherals { /// Cache and branch predictor maintenance operations (not present on Cortex-M0 variants) pub CBP: CBP, @@ -126,6 +125,10 @@ pub struct Peripherals { /// Trace Port Interface Unit (not present on Cortex-M0 variants) pub TPIU: TPIU, + + // Private field making `Peripherals` non-exhaustive. We don't use `#[non_exhaustive]` so we + // can support older Rust versions. + _priv: (), } // NOTE `no_mangle` is used here to prevent linking different minor versions of this crate as that @@ -188,6 +191,7 @@ impl Peripherals { TPIU: TPIU { _marker: PhantomData, }, + _priv: (), } } } -- cgit v1.2.3