Skip to content

Commit d44a5fa

Browse files
Use a private field instead of #[non_exhaustive]
1 parent 6e63b1e commit d44a5fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/peripheral/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ mod test;
8989

9090
/// Core peripherals
9191
#[allow(non_snake_case)]
92-
#[non_exhaustive]
9392
pub struct Peripherals {
9493
/// Cache and branch predictor maintenance operations (not present on Cortex-M0 variants)
9594
pub CBP: CBP,
@@ -126,6 +125,10 @@ pub struct Peripherals {
126125

127126
/// Trace Port Interface Unit (not present on Cortex-M0 variants)
128127
pub TPIU: TPIU,
128+
129+
// Private field making `Peripherals` non-exhaustive. We don't use `#[non_exhaustive]` so we
130+
// can support older Rust versions.
131+
_priv: (),
129132
}
130133

131134
// NOTE `no_mangle` is used here to prevent linking different minor versions of this crate as that
@@ -188,6 +191,7 @@ impl Peripherals {
188191
TPIU: TPIU {
189192
_marker: PhantomData,
190193
},
194+
_priv: (),
191195
}
192196
}
193197
}

0 commit comments

Comments
 (0)