Skip to content

Commit 33e3440

Browse files
Merge pull request #60 from us-irs/fix-keyword-order
2 parents 09780ef + a9c9142 commit 33e3440

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Keyword order for arrays of inner fields when used with with `const_inner`.
13+
14+
### Added
15+
16+
- Missing `const` for unchecked inner MMIO block getter when using `const_inner`.
17+
1018
## [v0.6.0] - 2025-07-11
1119

1220
### Changed

macro/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl FieldParser {
457457
#[doc = "based on a raw pointer which might lead to undefined behaviour on invalid offsets."]
458458
#[doc = "Users MUST ensure that the offset is valid."]
459459
#[inline]
460-
pub unsafe fn #field_ident_unchecked(&mut self, index: usize) -> #inner_mmio_path<'_> {
460+
pub #const_token unsafe fn #field_ident_unchecked(&mut self, index: usize) -> #inner_mmio_path<'_> {
461461
unsafe {
462462
self.#steal_func_name_unchecked(index)
463463
}
@@ -505,7 +505,7 @@ impl FieldParser {
505505
#[doc = "based on a raw pointer which might lead to undefined behaviour on invalid offsets."]
506506
#[doc = "Users MUST ensure that the offset is valid."]
507507
#[inline]
508-
pub unsafe #const_token fn #field_ident_shared_unchecked(&self, index: usize) -> derive_mmio::SharedInner<#inner_mmio_path<'_>> {
508+
pub #const_token unsafe fn #field_ident_shared_unchecked(&self, index: usize) -> derive_mmio::SharedInner<#inner_mmio_path<'_>> {
509509
derive_mmio::SharedInner::__new_internal(
510510
unsafe {
511511
self.#private_steal_unchecked_func_name(index)

tests/constness.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ struct Uart {
1414
control: u32,
1515
#[mmio(Inner)]
1616
bank_0: UartBank,
17+
#[mmio(Inner)]
18+
multi_banks: [UartBank; 2],
1719
}
1820

1921
pub struct UartDriver {
@@ -37,6 +39,14 @@ impl UartDriver {
3739
self.regs.bank_0_shared()
3840
}
3941

42+
pub const fn const_bank_1_shared(&mut self) -> MmioUartBank<'_> {
43+
unsafe { self.regs.multi_banks_unchecked(0) }
44+
}
45+
46+
pub const fn const_steal_bank_2_shared(&mut self) -> MmioUartBank<'static> {
47+
unsafe { self.regs.steal_multi_banks_unchecked(1) }
48+
}
49+
4050
pub const fn const_steal_bank_0_shared(
4151
&mut self,
4252
) -> derive_mmio::SharedInner<MmioUartBank<'static>> {

0 commit comments

Comments
 (0)