Got an gpio expander with interrupts on input pins, and configuring/de-configuring the interrupts is an interesting issue as it is all async and dropping the pin leaves an interrupt register still configured. Talk by @dirbaio @ RustNL inspired me to panic in the drop function to disallow it. ``` pub struct InterruptPin<'a, PULLUPDOWN, MARKER: PinMarker, T>( ManuallyDrop, MARKER, T>>, ); impl<'a, PULLUPDOWN, MARKER: PinMarker, T, E> InterruptPin<'a, PULLUPDOWN, MARKER, T> where T: I2c, { fn new(pin: Pin<'a, Input, MARKER, T>) -> Self { Self(ManuallyDrop::new(pin)) } pub async fn deconfigure_interrupt( mut self, ) -> Result, MARKER, T>, E> { self.0.configure_interrupt(false).await?; // Deconstruct `self` into the inner pin without calling drop on `self`. let pin = unsafe { ManuallyDrop::take(&mut self.0) }; core::mem::forget(self); // Prevent drop from being called on `self`. Ok(pin) } } impl<'a, PULLUPDOWN, MARKER: PinMarker, T> Drop for InterruptPin<'a, PULLUPDOWN, MARKER, T> { fn drop(&mut self) { panic!("Please call deconfigure_interrupt when dropping this pin"); } } ```