stm32-rs / stm32f0xx-hal

A Rust `embedded-hal` implementation for all MCUs in the STM32 F0 family
BSD Zero Clause License
134 stars 59 forks source link

Fix compilation error in spi.rs for rust Version 1.73+ #170

Closed JanekGraff closed 11 months ago

JanekGraff commented 11 months ago

With rust version 1.73.0 the invalid_reference_casting lint was set to deny by default. (See PR#112431. This causes the build process of this crate to fail to build spi.rs (only when building the crate with its examples, when adding it as a dependency works fine from what i can see).

This change fixes the compilation by adding the [allow(invalid_reference_casting)] attribute to the relevant parts.

This also fixes a unused doc comment compilation warning in rcc.rs

NOTE

I have not tested this on hardware, just added the attribute to fix the compilation.

adamgreig commented 11 months ago

See also https://github.com/stm32-rs/stm32f7xx-hal/pull/207 and https://github.com/stm32-rs/stm32f3xx-hal/pull/346 which had the same problem and a couple other options for fixing it.

therealprof commented 11 months ago

@JanekGraff Thanks for trying to fix this. Would you mind changing to core::ptr::addr_of! instead of squelching the warning?

Unrelated nit: Could you please remove the added newlines between the links in the CHANGELOG.md?

JanekGraff commented 11 months ago

@JanekGraff Thanks for trying to fix this. Would you mind changing to core::ptr::addr_of! instead of squelching the warning?

Unrelated nit: Could you please remove the added newlines between the links in the CHANGELOG.md?

Sure thing, done.