Skip to content

Commit 8b7eeba

Browse files
committed
rust: update toolchain to 1.69.0
Our own `str_from_null_terminated` could also be replaced with `core::ffi::CStr::from_bytes_until_nul` which was stabilized in this Rust release. See https://github.com/rust-lang/rust/blob/b92a41c6760801a7128ca0ec69ba4ba9c9194054/RELEASES.md#stabilized-apis. Unfortunately with this release the firmware.bin comes out 1928 bytes larger.
1 parent f4cf087 commit 8b7eeba

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

.ci/run-container-ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
set -e
2626
set -x
2727

28-
CONTAINER=shiftcrypto/firmware_v2:32
28+
CONTAINER=shiftcrypto/firmware_v2:33
2929

3030
if [ "$1" == "pull" ] ; then
3131
docker pull "$CONTAINER"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ RUN rustup target add thumbv7em-none-eabi
130130
RUN rustup component add rustfmt
131131
RUN rustup component add clippy
132132
RUN CARGO_HOME=/opt/cargo cargo install cbindgen --version 0.24.3
133-
RUN CARGO_HOME=/opt/cargo cargo install bindgen-cli --version 0.64.0
133+
RUN CARGO_HOME=/opt/cargo cargo install bindgen-cli --version 0.65.1
134134

135135
COPY tools/prost-build-proto prost-build-proto
136136
RUN CARGO_HOME=/opt/cargo cargo install --path prost-build-proto --locked

src/rust/bitbox02/src/util.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ use alloc::vec::Vec;
1818
/// Parses a utf-8 string out of a null terminated buffer. Returns `Err(())` if there
1919
/// is no null terminator or if the bytes before the null terminator is invalid UTF8.
2020
pub fn str_from_null_terminated(input: &[u8]) -> Result<&str, ()> {
21-
let len = input.iter().position(|&c| c == 0).ok_or(())?;
22-
core::str::from_utf8(&input[0..len]).or(Err(()))
21+
core::ffi::CStr::from_bytes_until_nul(input)
22+
.or(Err(()))?
23+
.to_str()
24+
.or(Err(()))
2325
}
2426

2527
/// Parses a utf-8 string out of a null terminated buffer starting at `ptr`. Returns `Err(())` if

src/rust/rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.68.0
1+
1.69.0

0 commit comments

Comments
 (0)