Skip to content

Commit f682b0b

Browse files
committed
use core::ptr::from_ref
1 parent 65fb8e0 commit f682b0b

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- { rust: stable, vendor: Toshiba, options: all }
8585
- { rust: stable, vendor: Toshiba, options: "" }
8686
# Test MSRV
87-
- { rust: 1.74.0, vendor: Nordic, options: "" }
87+
- { rust: 1.76.0, vendor: Nordic, options: "" }
8888
# Use nightly for architectures which don't support stable
8989
- { rust: nightly, vendor: MSP430, options: "--atomics" }
9090
- { rust: nightly, vendor: MSP430, options: "" }

CHANGELOG.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
99

10+
- Bump MSRV of generated code to 1.76
1011
- move `must_use` from methods to generic type
1112

1213
## [v0.33.5] - 2024-10-12
@@ -907,9 +908,7 @@ peripheral.register.write(|w| w.field().set());
907908

908909
- Initial version of the `svd2rust` tool
909910

910-
[Unreleased]: https://github.com/rust-embedded/svd2rust/compare/v0.33.5...HEAD
911-
[v0.33.5]: https://github.com/rust-embedded/svd2rust/compare/v0.33.4...v0.33.5
912-
[v0.33.4]: https://github.com/rust-embedded/svd2rust/compare/v0.33.3...v0.33.4
911+
[Unreleased]: https://github.com/rust-embedded/svd2rust/compare/v0.33.3...HEAD
913912
[v0.33.3]: https://github.com/rust-embedded/svd2rust/compare/v0.33.2...v0.33.3
914913
[v0.33.2]: https://github.com/rust-embedded/svd2rust/compare/v0.33.1...v0.33.2
915914
[v0.33.1]: https://github.com/rust-embedded/svd2rust/compare/v0.33.0...v0.33.1

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ This project is developed and maintained by the [Tools team][team].
1717

1818
## Minimum Supported Rust Version (MSRV)
1919

20-
The **generated code** is guaranteed to compile on stable Rust 1.65.0 and up.
20+
The **generated code** is guaranteed to compile on stable Rust 1.76.0 and up.
2121

22-
If you encounter compilation errors on any stable version newer than 1.65.0, please open an issue.
22+
If you encounter compilation errors on any stable version newer than 1.76.0, please open an issue.
2323

2424
# Testing Locally
2525

src/generate/peripheral/accessor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl ToTokens for AccessType {
5555
#[doc = #doc]
5656
#[inline(always)]
5757
pub const fn #name(&self) -> &#ty {
58-
unsafe { &*(self as *const Self).cast::<u8>().add(#offset).cast() }
58+
unsafe { &*core::ptr::from_ref(self).cast::<u8>().add(#offset).cast() }
5959
}
6060
}
6161
}
@@ -84,7 +84,7 @@ impl ToTokens for AccessType {
8484
increment,
8585
})) => {
8686
let name_iter = Ident::new(&format!("{name}_iter"), Span::call_site());
87-
let cast = quote! { unsafe { &*(self as *const Self).cast::<u8>().add(#offset).add(#increment * n).cast() } };
87+
let cast = quote! { unsafe { &*core::ptr::from_ref(self).cast::<u8>().add(#offset).add(#increment * n).cast() } };
8888
quote! {
8989
#[doc = #doc]
9090
#[inline(always)]

0 commit comments

Comments
 (0)