mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
chore(core/rust): bump cstr_core, enable nightly features
So that cstr! can be used in const contexts. This is not critical but it's nice-to-have as long as we are on nightly anyway.
This commit is contained in:
parent
c8fa687c1e
commit
d674634c86
4
core/embed/rust/Cargo.lock
generated
4
core/embed/rust/Cargo.lock
generated
@ -73,9 +73,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cstr_core"
|
||||
version = "0.2.4"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "917ba9efe9e1e736671d5a03f006afc4e7e3f32503e2077e0bcaf519c0c8c1d3"
|
||||
checksum = "dd98742e4fdca832d40cab219dc2e3048de17d873248f83f17df47c1bea70956"
|
||||
dependencies = [
|
||||
"cty",
|
||||
"memchr",
|
||||
|
@ -90,8 +90,9 @@ default_features = false
|
||||
version = "0.3.3"
|
||||
|
||||
[dependencies.cstr_core]
|
||||
version = "0.2.4"
|
||||
default_features = false
|
||||
version = "0.2.6"
|
||||
default-features = false
|
||||
features = ["nightly"]
|
||||
|
||||
# Build dependencies
|
||||
|
||||
|
@ -29,7 +29,7 @@ pub enum Error {
|
||||
#[macro_export]
|
||||
macro_rules! value_error {
|
||||
($msg:expr) => {
|
||||
Error::ValueError(cstr!($msg))
|
||||
Error::ValueError(cstr_core::cstr!($msg))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,11 @@ use cstr_core::cstr;
|
||||
|
||||
use crate::{error::Error, micropython::qstr::Qstr};
|
||||
|
||||
// XXX const version of `from_bytes_with_nul_unchecked` is nightly-only.
|
||||
|
||||
pub fn experimental_not_enabled() -> Error {
|
||||
pub const fn experimental_not_enabled() -> Error {
|
||||
value_error!("Experimental features are disabled.")
|
||||
}
|
||||
|
||||
pub fn unknown_field_type() -> Error {
|
||||
pub const fn unknown_field_type() -> Error {
|
||||
value_error!("Unknown field type.")
|
||||
}
|
||||
|
||||
@ -20,6 +18,6 @@ pub fn invalid_value(field: Qstr) -> Error {
|
||||
Error::ValueErrorParam(cstr!("Invalid value for field."), field.into())
|
||||
}
|
||||
|
||||
pub fn end_of_buffer() -> Error {
|
||||
pub const fn end_of_buffer() -> Error {
|
||||
value_error!("End of buffer.")
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
use super::ffi;
|
||||
use crate::error::Error;
|
||||
use core::ptr;
|
||||
use cstr_core::{cstr, CStr};
|
||||
use cstr_core::CStr;
|
||||
|
||||
/// Result of PIN delay callback.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
|
@ -18,7 +18,6 @@ use crate::{
|
||||
util::set_animation_disabled,
|
||||
},
|
||||
};
|
||||
use cstr_core::cstr;
|
||||
use heapless::Vec;
|
||||
|
||||
#[cfg(feature = "jpeg")]
|
||||
|
@ -1,5 +1,4 @@
|
||||
use core::{cmp::Ordering, convert::TryInto};
|
||||
use cstr_core::cstr;
|
||||
|
||||
use crate::{
|
||||
error::Error,
|
||||
|
Loading…
Reference in New Issue
Block a user