Skip to content

Commit a47f0b8

Browse files
Dominaezzzbugadani
andauthored
Replace unsafe with new std API (#4178)
* Replace unsafe with new std API * bump * Fix link in readme --------- Co-authored-by: Dániel Buga <[email protected]>
1 parent c233ca7 commit a47f0b8

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

esp-bootloader-esp-idf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "esp-bootloader-esp-idf"
33
version = "0.2.0"
44
edition = "2024"
5-
rust-version = "1.86.0"
5+
rust-version = "1.88.0"
66
description = "Functionality related to the esp-idf bootloader"
77
documentation = "https://docs.espressif.com/projects/rust/esp-bootloader-esp-idf/latest/"
88
keywords = ["esp32", "espressif", "no-std"]

esp-bootloader-esp-idf/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Crates.io](https://img.shields.io/crates/v/esp-bootloader-esp-idf?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/esp-bootloader-esp-idf)
44
[![docs.rs](https://img.shields.io/docsrs/esp-bootloader-esp-idf?labelColor=1C2C2E&color=C96329&logo=rust&style=flat-square)](https://docs.espressif.com/projects/rust/esp-bootloader-esp-idf/latest/)
5-
![MSRV](https://img.shields.io/badge/MSRV-1.86.0-blue?labelColor=1C2C2E&style=flat-square)
5+
![MSRV](https://img.shields.io/badge/MSRV-1.88.0-blue?labelColor=1C2C2E&style=flat-square)
66
![Crates.io](https://img.shields.io/crates/l/esp-bootloader-esp-idf?labelColor=1C2C2E&style=flat-square)
77
[![Matrix](https://img.shields.io/matrix/esp-rs:matrix.org?label=join%20matrix&labelColor=1C2C2E&color=BEC5C9&logo=matrix&style=flat-square)](https://matrix.to/#/#esp-rs:matrix.org)
88

esp-bootloader-esp-idf/src/partitions.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ impl<'a> PartitionTable<'a> {
199199
return Err(Error::Invalid);
200200
}
201201

202-
if binary.len() % RAW_ENTRY_LEN != 0 {
202+
let (binary, rem) = binary.as_chunks::<RAW_ENTRY_LEN>();
203+
if !rem.is_empty() {
203204
return Err(Error::Invalid);
204205
}
205206

@@ -210,14 +211,6 @@ impl<'a> PartitionTable<'a> {
210211
});
211212
}
212213

213-
// we checked binary before
214-
let binary = unsafe {
215-
core::slice::from_raw_parts(
216-
binary.as_ptr() as *const [u8; RAW_ENTRY_LEN],
217-
binary.len() / RAW_ENTRY_LEN,
218-
)
219-
};
220-
221214
let mut raw_table = Self {
222215
binary,
223216
entries: binary.len(),

0 commit comments

Comments
 (0)