diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-08-02 12:40:01 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-08-02 19:55:04 +0200 |
| commit | 63ac7ac799b07c18a9a621b4d20ead2b39982ef5 (patch) | |
| tree | 714ed050cb55ef90bfa2d3a94e9318e8e2acc724 /embassy-hal-common | |
| parent | af87031d62ca9ee5e7dd44cba297f3d171ec0708 (diff) | |
Mark `new`s as unsafe due to not being leak-safe.
Diffstat (limited to 'embassy-hal-common')
| -rw-r--r-- | embassy-hal-common/src/usb/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-hal-common/src/usb/mod.rs b/embassy-hal-common/src/usb/mod.rs index 0940e6b02..ae9f26075 100644 --- a/embassy-hal-common/src/usb/mod.rs +++ b/embassy-hal-common/src/usb/mod.rs | |||
| @@ -60,7 +60,8 @@ where | |||
| 60 | T: ClassSet<B>, | 60 | T: ClassSet<B>, |
| 61 | I: USBInterrupt, | 61 | I: USBInterrupt, |
| 62 | { | 62 | { |
| 63 | pub fn new<S: IntoClassSet<B, T>>( | 63 | /// safety: the returned instance is not leak-safe |
| 64 | pub unsafe fn new<S: IntoClassSet<B, T>>( | ||
| 64 | state: &'bus mut State<'bus, B, T, I>, | 65 | state: &'bus mut State<'bus, B, T, I>, |
| 65 | device: UsbDevice<'bus, B>, | 66 | device: UsbDevice<'bus, B>, |
| 66 | class_set: S, | 67 | class_set: S, |
| @@ -71,7 +72,7 @@ where | |||
| 71 | classes: class_set.into_class_set(), | 72 | classes: class_set.into_class_set(), |
| 72 | _interrupt: PhantomData, | 73 | _interrupt: PhantomData, |
| 73 | }; | 74 | }; |
| 74 | let mutex = unsafe { PeripheralMutex::new_unchecked(&mut state.0, initial_state, irq) }; | 75 | let mutex = PeripheralMutex::new_unchecked(&mut state.0, initial_state, irq); |
| 75 | Self { | 76 | Self { |
| 76 | inner: RefCell::new(mutex), | 77 | inner: RefCell::new(mutex), |
| 77 | } | 78 | } |
