-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
svd2rust seems to generate code that fails to compile on rustc v1.85.0:
❯ cargo build
Compiling stm32l476 v0.1.0 (/home/lenny/Source/stm32l476)
error: unsafe attribute used without unsafe
--> src/lib.rs:1034:3
|
1034 | #[no_mangle]
| ^^^^^^^^^ usage of unsafe attribute
|
help: wrap the attribute in `unsafe(...)`
|
1034 | #[unsafe(no_mangle)]
| +++++++ +
Manually adding the unsafe wrapper fixes things.
The chunk in question:
#[doc = "Digital camera interface"]
pub mod dcmi;
#[no_mangle]
static mut DEVICE_PERIPHERALS: bool = false;
#[doc = r" All the peripherals."]
#[allow(non_snake_case)]
pub struct Peripherals {
#[doc = "DAC"]
pub dac: Dac,
#[doc = "DMA1"]
pub dma1: Dma1,
#[doc = "DMA2"]
pub dma2: Dma2,
#[doc = "CRC"]
pub crc: Crc,
// ...
}
SVD file used: https://www.st.com/resource/en/svd/stm32l4_svd.zip
Metadata
Metadata
Assignees
Labels
No labels