From 06bb998475998bbbacf4a50542c4a4c87931f80c Mon Sep 17 00:00:00 2001 From: Chien Wong Date: Sat, 25 Nov 2023 22:34:24 +0800 Subject: [PATCH] Fix compile error of 'assigning to `&T` is undefined behavior' Signed-off-by: Chien Wong --- src/serial.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/serial.rs b/src/serial.rs index da4c404..0cdd83c 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -419,6 +419,7 @@ impl crate::hal::serial::Write for Tx { // NOTE(unsafe) atomic write to stateless register // NOTE(write_volatile) 8-bit write that's not possible through the svd2rust API unsafe { + #[allow(invalid_reference_casting)] ptr::write_volatile(&(*USART::ptr()).data as *const _ as *mut _, byte) } Ok(())