Skip to content

Commit fffc253

Browse files
bors[bot]burrbull
andauthored
Merge #694
694: const alternate register accessors r=therealprof a=burrbull Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents fc2d126 + c83d299 commit fffc253

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
- { rust: stable, vendor: Toshiba, options: all }
7373
- { rust: stable, vendor: Toshiba, options: "" }
7474
# Test MSRV
75-
- { rust: 1.60.0, vendor: Nordic, options: "" }
75+
- { rust: 1.61.0, vendor: Nordic, options: "" }
7676
# Use nightly for architectures which don't support stable
7777
- { rust: nightly, vendor: MSP430, options: "--nightly" }
7878
- { rust: nightly, vendor: MSP430, options: "" }

CHANGELOG.md

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

88
## [Unreleased]
99

10+
- mark alternate register accessors with `const`, bump `pac` MSRV to 1.61
1011
- `fields` fn refactoring
1112
- Test patched STM32
1213
- simplify ci strategy

README.md

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

1414
## Minimum Supported Rust Version (MSRV)
1515

16-
The **generated code** is guaranteed to compile on stable Rust 1.60.0 and up.
16+
The **generated code** is guaranteed to compile on stable Rust 1.61.0 and up.
1717

18-
If you encounter compilation errors on any stable version newer than 1.60.0, please open an issue.
18+
If you encounter compilation errors on any stable version newer than 1.61.0, please open an issue.
1919

2020
# Testing Locally
2121

src/generate/peripheral.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,8 @@ fn register_or_cluster_block(
535535
accessors.extend(quote! {
536536
#[doc = #comment]
537537
#[inline(always)]
538-
pub fn #name(&self) -> &#ty {
539-
unsafe {
540-
&*(((self as *const Self) as *const u8).add(#offset) as *const #ty)
541-
}
538+
pub const fn #name(&self) -> &#ty {
539+
unsafe { &*(self as *const Self).cast::<u8>().add(#offset).cast() }
542540
}
543541
});
544542
} else {

0 commit comments

Comments
 (0)