stm32l4xx-hal
stm32l4xx-hal copied to clipboard
Does this actually compile with current rust version?
I tried to fork and run cargo build --features stm32l476 but got like 5 similar errors
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
--> src/spi.rs:271:34
|
271 | unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I'm new to embedded rust so maybe I'm missing some steps before building. Any help appreciated thank you!!
Hi,
Rust 1.73 rules made this cast "illegal".
Use instead in spi.rs, qspi.rs and serial.rs
unsafe { ptr::write_volatile(UnsafeCell::raw_get(&self.spi.dr as *const _ as *mut _), byte) }
don't forget to import core::cell::UnsafeCell
the same will apply to read_volatile.
Feel free to check my fork here