Skip to content

Commit b78fe45

Browse files
committed
bootloader/rust: avoid compiler regression that increases the bin size
rust-lang/rust#83925 For now we just remove the one instance of .unwrap() that is used in the bootloader, removing most of the bootloader size increase.
1 parent c82d4d8 commit b78fe45

File tree

1 file changed

+6
-1
lines changed
  • src/rust/bitbox02-rust-c/src

1 file changed

+6
-1
lines changed

src/rust/bitbox02-rust-c/src/util.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ pub extern "C" fn rust_util_validate_name(cstr: CStr, max_len: size_t) -> bool {
3939
pub extern "C" fn rust_util_uint8_to_hex(buf: Bytes, mut out: CStrMut) {
4040
let min_len = buf.len * 2;
4141
out.write(min_len, |out| {
42-
hex::encode_to_slice(&buf, out).unwrap();
42+
// Avoid .unwrap() here until the following compiler regression is fixed:
43+
// https://github.com/rust-lang/rust/issues/83925
44+
match hex::encode_to_slice(&buf, out) {
45+
Ok(()) => {}
46+
Err(err) => panic!("{:?}", err),
47+
}
4348
});
4449
}
4550

0 commit comments

Comments
 (0)