Skip to content

Commit 73b81e6

Browse files
authored
Merge pull request #170 from JanekGraff/compile-fix
Fix compilation error in spi.rs for rust Version 1.73+
2 parents eed06fb + ec3e603 commit 73b81e6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2121

2222
- Wrong mode when using PWM channel 2 of a two-channel timer
2323
- `adc_values` example conversion error
24+
- `invalid_reference_casting` Compilation error in spi.rs for Rust version 1.73+ (
25+
See [PR#112431](https://github.com/rust-lang/rust/pull/112431) for more info)
26+
- `unused_doc_comments` Warning in rcc.rs
2427

2528
## [v0.18.0] - 2021-11-14
2629

src/rcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl RccExt for RCC {
1414
pclk: None,
1515
sysclk: None,
1616
clock_src: SysClkSource::HSI,
17-
/// CRS is only available on devices with HSI48
17+
// CRS is only available on devices with HSI48
1818
#[cfg(any(
1919
feature = "stm32f042",
2020
feature = "stm32f048",

src/spi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ where
413413

414414
fn send_u8(&mut self, byte: u8) {
415415
// NOTE(write_volatile) see note above
416-
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) }
416+
unsafe { ptr::write_volatile(ptr::addr_of!(self.spi.dr) as *mut u8, byte) }
417417
}
418418

419419
fn read_u16(&mut self) -> u16 {
@@ -423,7 +423,7 @@ where
423423

424424
fn send_u16(&mut self, byte: u16) {
425425
// NOTE(write_volatile) see note above
426-
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u16, byte) }
426+
unsafe { ptr::write_volatile(ptr::addr_of!(self.spi.dr) as *mut u16, byte) }
427427
}
428428

429429
pub fn release(self) -> (SPI, (SCKPIN, MISOPIN, MOSIPIN)) {

0 commit comments

Comments
 (0)