mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-08 23:58:09 +00:00

core: Remove dangling module decls
core: Use new Cargo feature resolver, use external MacOS debug info
core: Rust docs improvements
core: Upgrade bindgen
core: Add test target to Rust
ci: build rust sources
build(core): .ARM.exidx.text.__aeabi_ui2f in t1 firmware size
It's an unwind table for softfloat function inserted by rustc, probably
can be removed to save 8 bytes:
599c58db70/link.x.in (L175-L182)
scons: Remove dead code
core: Move Rust target to build/rust
core: Replace extern with a FFI version
core: Add some explanatory Rust comments
core: Use correct path for the Rust lib
core: Remove Buffer::as_mut()
Mutable buffer access needs MP_BUFFER_WRITE flag. TBD in the Protobuf PR.
core: Improve docs for micropython::Buffer
core: Minor Rust docs changes
core: Rewrite trezor_obj_get_ll_checked
core: Fix incorrect doc comment
core: Remove cc from deps
fixup! core: Rewrite trezor_obj_get_ll_checked
core: update safety comments
19 lines
596 B
Rust
19 lines
596 B
Rust
use super::{ffi, obj::Obj};
|
|
|
|
pub type Func = ffi::mp_obj_fun_builtin_fixed_t;
|
|
|
|
impl Func {
|
|
/// Convert a "static const" function to a MicroPython object.
|
|
pub const fn to_obj(&'static self) -> Obj {
|
|
// SAFETY:
|
|
// - We are an object struct with a base and a type.
|
|
// - 'static lifetime holds us in place.
|
|
// - MicroPython is smart enough not to mutate `mp_obj_fun_builtin_fixed_t`
|
|
// objects.
|
|
unsafe { Obj::from_ptr(self as *const _ as *mut _) }
|
|
}
|
|
}
|
|
|
|
// SAFETY: We are in a single-threaded environment.
|
|
unsafe impl Sync for Func {}
|