Skip to content

Commit f4a317e

Browse files
authored
Merge pull request #820 from rust-embedded/core-ptr
use core::ptr::from_ref
2 parents 65fb8e0 + 228bfc4 commit f4a317e

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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/generic_atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mod atomic {
3939

4040
impl<REG: Readable + Writable> Reg<REG>
4141
where
42-
REG::Ux: AtomicOperations + Default + core::ops::Not<Output = REG::Ux>,
42+
REG::Ux: AtomicOperations
4343
{
4444
/// Set high every bit in the register that was set in the write proxy. Leave other bits
4545
/// untouched. The write is done in a single atomic instruction.

src/generate/peripheral/accessor.rs

Lines changed: 2 additions & 2 deletions
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)