Skip to content

Commit e717996

Browse files
authored
treewide: add validation on const trait parameters
1 parent f8a7c2a commit e717996

File tree

8 files changed

+14
-7
lines changed

8 files changed

+14
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- "stm32wl5x_cm4"
2424
- "stm32wle5"
2525
toolchain:
26-
- "1.56" # MSRV
26+
- "1.57" # MSRV
2727
- "beta"
2828
exclude:
2929
- mcu: "stm32wl5x_cm0p"

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Added a `flash` module with erase and program functionality.
1212
- Added `defmt::Format` for all types declared in the BSPs.
1313

14+
### Changed
15+
- Changed minimum rust version from 1.56 to 1.57 for `const_panic`.
16+
1417
## [0.2.1] - 2021-11-20
1518
### Fixed
1619
- Fixed timeouts after calling `SubGhz::set_sleep`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![stable-docs](https://img.shields.io/badge/docs-stable-blue)](https://docs.rs/stm32wlxx-hal/)
55
[![nightly-docs](https://img.shields.io/badge/docs-nightly-black)](https://stm32-rs.github.io/stm32wlxx-hal/stm32wlxx_hal/index.html)
66
[![crates.io](https://img.shields.io/crates/v/stm32wlxx-hal.svg)](https://crates.io/crates/stm32wlxx-hal)
7-
[![rustc](https://img.shields.io/badge/rustc-1.56+-blue.svg)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
7+
[![rustc](https://img.shields.io/badge/rustc-1.57+-blue.svg)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
88

99
Embedded rust HAL (hardware abstraction layer) for the STM32WL series.
1010

hal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "../README.md"
66
version = "0.2.1" # update BSP versions, BSP HAL depdendency version, README, and BSP READMEs
77
authors = ["Alex Martens <[email protected]>"]
88
edition = "2021"
9-
rust-version = "1.56" # update MSRV in CI, BSPs, and shield in README
9+
rust-version = "1.57" # update MSRV in CI, BSPs, and shield in README
1010
license = "MIT OR Apache-2.0"
1111
keywords = ["arm", "cortex-m", "stm32", "hal"]
1212
categories = ["embedded", "hardware-support", "no-std"]

hal/src/dma/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pub(crate) struct Dma<const BASE: usize, const CH: u8> {}
6060
impl<const BASE: usize, const CH: u8> Dma<BASE, CH> {
6161
pub const MUX_CH: u8 = match BASE {
6262
DMA1_BASE => CH,
63-
// TODO: replace with const panic when avaliable
64-
_ => CH + 7,
63+
DMA2_BASE => CH + 7,
64+
_ => core::panic!("DMA base address is invalid"),
6565
};
6666
const MUX_CR: *mut u32 = (MUX_BASE + 0x4 * (Self::MUX_CH as usize)) as *mut u32;
6767
// const MUX_RGCR: *mut u32 = (MUX_BASE + 0x100 + 0x4 * (Self::MUX_CH as usize)) as *mut u32;

hal/src/gpio.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ pub enum Pull {
7070
struct Pin<const BASE: usize, const N: u8> {}
7171

7272
impl<const BASE: usize, const N: u8> Pin<BASE, N> {
73+
const _NPANIC: () = if N > 15 {
74+
core::panic!("Pin index is out of range")
75+
};
76+
7377
const MODER_R: *const u32 = BASE as *const u32;
7478
const MODER_W: *mut u32 = BASE as *mut u32;
7579
const OTYPER_R: *const u32 = (BASE + 0x4) as *const u32;

lora-e5-bsp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
version = "0.2.1"
77
authors = ["Alex Martens <[email protected]>"]
88
edition = "2021"
9-
rust-version = "1.56"
9+
rust-version = "1.57"
1010
license = "MIT OR Apache-2.0"
1111
keywords = ["arm", "cortex-m", "stm32", "bsp", "seeed"]
1212
categories = ["embedded", "hardware-support", "no-std"]

nucleo-wl55jc-bsp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
version = "0.2.1"
77
authors = ["Alex Martens <[email protected]>"]
88
edition = "2021"
9-
rust-version = "1.56"
9+
rust-version = "1.57"
1010
license = "MIT OR Apache-2.0"
1111
keywords = ["arm", "cortex-m", "stm32", "bsp", "nucleo"]
1212
categories = ["embedded", "hardware-support", "no-std"]

0 commit comments

Comments
 (0)