refactor(core/rust): update obj_type! for slots-based mp_obj_type_t
What changed, and why it matters
This is a routine internal refactoring in the Trezor firmware's Rust code. It updates how Rust code builds MicroPython object type definitions to match a newer version of MicroPython that stores type information in a 'slots' array rather than a flat structure. There is no user-facing feature change and no indication of a security fix.
No security action required. Treat as normal code maintenance. Reviewers may verify that the new slot indices match the upstream MicroPython layout and that all `obj_type!` call sites compile and pass existing tests.
Security signals we found
No security-relevant signals present in commit message or diff
Refactoring only: no change to trust boundaries, input validation, or cryptographic logic
No changelog entry requested by commit author ([no changelog])
Evidence from the diff
The commit adapts the obj_type! macro and related Rust bindings to MicroPython’s new slots-based mp_obj_type_t representation (upstream commits 3ac8b585 and cb0ffdd2). It replaces direct struct-field initialization with slot-index assignment, introduces mp_obj_full_type_t as the concrete return type, and updates call sites to use .as_type() where a &Type is required. The changes are mechanical and pervasive across Rust MicroPython wrappers.
Changed components
core/embed/rust build scriptcore/embed/rust MicroPython FFI bindingscore/embed/rust obj_type! macroRust-defined MicroPython type objects across UI, protobuf, translations, THP, BLE, and trezorhal modulesInspect captured patch +170 / −101
diff --git a/core/embed/rust/build.rs b/core/embed/rust/build.rs
index 0d04b957..98dc5ef1 100644
--- a/core/embed/rust/build.rs
+++ b/core/embed/rust/build.rs
@@ -44,6 +44,12 @@ fn generate_micropython_bindings(lib: &mut CLibrary) -> Result<()> {
.new_type_alias("mp_obj_t")
.allowlist_type("mp_obj_type_t")
.allowlist_type("mp_obj_base_t")
+ .allowlist_type("mp_obj_full_type_t")
+ .allowlist_type("mp_attr_fun_t")
+ .allowlist_type("mp_call_fun_t")
+ .allowlist_type("mp_make_new_fun_t")
+ .allowlist_type("mp_print_fun_t")
+ .allowlist_type("mp_buffer_fun_t")
.allowlist_function("mp_obj_new_int")
.allowlist_function("mp_obj_new_int_from_ll")
.allowlist_function("mp_obj_new_int_from_ull")
@@ -58,6 +64,7 @@ fn generate_micropython_bindings(lib: &mut CLibrary) -> Result<()> {
.allowlist_function("mp_call_function_n_kw")
.allowlist_function("trezor_obj_get_ll_checked")
.allowlist_function("trezor_obj_str_from_rom_text")
+ .allowlist_var("MP_TYPE_FLAG_NONE")
// buffer
.allowlist_function("mp_obj_new_slice")
.allowlist_function("mp_obj_subscr")
diff --git a/core/embed/rust/src/micropython/exception.rs b/core/embed/rust/src/micropython/exception.rs
index ba5ce494..02369708 100644
--- a/core/embed/rust/src/micropython/exception.rs
+++ b/core/embed/rust/src/micropython/exception.rs
@@ -3,7 +3,7 @@
use super::ffi;
use super::obj::Obj;
use super::qstr::Qstr;
-use super::typ::Type;
+use super::typ::{FullType, Type};
pub const AttributeError: &Type = unsafe { &ffi::mp_type_AttributeError };
pub const EOFError: &Type = unsafe { &ffi::mp_type_EOFError };
@@ -17,7 +17,7 @@ pub const RuntimeError: &Type = unsafe { &ffi::mp_type_RuntimeError };
pub const TypeError: &Type = unsafe { &ffi::mp_type_TypeError };
pub const ValueError: &Type = unsafe { &ffi::mp_type_ValueError };
-pub const fn define_exception(name: Qstr, parent: &Type) -> Type {
+pub const fn define_exception(name: Qstr, parent: &Type) -> FullType {
obj_type! {
name: name,
make_new_fn: ffi::mp_obj_exception_make_new,
diff --git a/core/embed/rust/src/micropython/macros.rs b/core/embed/rust/src/micropython/macros.rs
index a8415270..75dde362 100644
--- a/core/embed/rust/src/micropython/macros.rs
+++ b/core/embed/rust/src/micropython/macros.rs
@@ -118,72 +118,102 @@ macro_rules! obj_type {
$(print_fn: $print_fn:path,)?
$(parent: $parent:path,)?
) => {{
- #[allow(unused_unsafe)]
- unsafe {
- use $crate::micropython::ffi;
+ use $crate::micropython::ffi;
- let name = $name.to_u16();
+ let name = $name.to_u16();
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut base_type: &'static ffi::mp_obj_type_t = &ffi::mp_type_type;
- $(base_type = &$base;)?
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ // SAFETY: micropython ffi
+ let mut base_type: &'static ffi::mp_obj_type_t = unsafe { &ffi::mp_type_type };
+ $(base_type = &$base;)?
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut attr: ffi::mp_attr_fun_t = None;
- $(attr = Some($attr_fn);)?
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ let mut attr: ffi::mp_attr_fun_t = None;
+ $(attr = Some($attr_fn);)?
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut call: ffi::mp_call_fun_t = None;
- $(call = Some($call_fn);)?
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ let mut call: ffi::mp_call_fun_t = None;
+ $(call = Some($call_fn);)?
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut make_new: ffi::mp_make_new_fun_t = None;
- $(make_new = Some($make_new_fn);)?
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ let mut make_new: ffi::mp_make_new_fun_t = None;
+ $(make_new = Some($make_new_fn);)?
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut print: ffi::mp_print_fun_t = None;
- $(print = Some($print_fn);)?
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ let mut print: ffi::mp_print_fun_t = None;
+ $(print = Some($print_fn);)?
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut parent: *const cty::c_void = ::core::ptr::null_mut();
- $(parent = $parent as *const _ as *mut _;)?
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ let mut parent: Option<&ffi::mp_obj_type_t> = None;
+ $(parent = Some($parent);)?
- // TODO: This is safe only if we pass in `Dict` with fixed `Map` (created by
- // `Map::fixed()`, usually through `obj_map!`), because only then will
- // MicroPython treat `locals_dict` as immutable, and make the mutable cast safe.
- #[allow(unused_mut)]
- #[allow(unused_assignments)]
- let mut locals_dict = ::core::ptr::null_mut();
- $(locals_dict = $locals as *const _ as *mut _;)?
+ // TODO: This is safe only if we pass in `Dict` with fixed `Map` (created by
+ // `Map::fixed()`, usually through `obj_map!`), because only then will
+ // MicroPython treat `locals_dict` as immutable, and make the mutable cast safe.
+ #[allow(unused_mut)]
+ #[allow(unused_assignments)]
+ let mut locals_dict: Option<&ffi::mp_obj_dict_t> = None;
+ $(locals_dict = Some($locals);)?
- ffi::mp_obj_type_t {
- base: ffi::mp_obj_base_t {
- type_: base_type,
- },
- flags: 0,
- name,
- print,
- make_new,
- call,
- unary_op: None,
- binary_op: None,
- attr,
- subscr: None,
- getiter: None,
- iternext: None,
- buffer_p: ffi::mp_buffer_p_t { get_buffer: None },
- protocol: ::core::ptr::null(),
- parent,
- locals_dict,
- }
+ const fn slot<T>(val: &Option<T>, num: u8) -> u8 {
+ if val.is_some() { num } else { 0 }
+ }
+
+ ffi::mp_obj_full_type_t {
+ base: ffi::mp_obj_base_t {
+ type_: base_type,
+ },
+ flags: ffi::MP_TYPE_FLAG_NONE as u16,
+ name,
+
+ slot_index_make_new: slot(&make_new, 1),
+ slot_index_print: slot(&print, 2),
+ slot_index_call: slot(&call, 3),
+ slot_index_unary_op: 0,
+ slot_index_binary_op: 0,
+ slot_index_attr: slot(&attr, 4),
+ slot_index_subscr: 0,
+ slot_index_iter: 0,
+ slot_index_buffer: 0,
+ slot_index_protocol: 0,
+ slot_index_parent: slot(&parent, 5),
+ slot_index_locals_dict: slot(&locals_dict, 6),
+
+ slots: [
+ obj_type!(@cast_fn make_new),
+ obj_type!(@cast_fn print),
+ obj_type!(@cast_fn call),
+ obj_type!(@cast_fn attr),
+ obj_type!(@cast_ref parent),
+ obj_type!(@cast_ref locals_dict),
+ ::core::ptr::null(),
+ ::core::ptr::null(),
+ ::core::ptr::null(),
+ ::core::ptr::null(),
+ ::core::ptr::null(),
+ ],
}
}};
+ // Option<unsafe extern "C" fn(...)> => *const cty::c_void
+ (@cast_fn $e:expr) => {
+ match $e {
+ None => ::core::ptr::null(),
+ Some(x) => x as *const cty::c_void,
+ }
+ };
+ // Option<&T> => *const cty::c_void
+ (@cast_ref $e:expr) => {
+ match $e {
+ None => ::core::ptr::null(),
+ Some(x) => x as *const _ as *const cty::c_void,
+ }
+ };
}
/// Construct an upymod definition.
diff --git a/core/embed/rust/src/micropython/simple_type.rs b/core/embed/rust/src/micropython/simple_type.rs
index a348ab80..5d0480a2 100644
--- a/core/embed/rust/src/micropython/simple_type.rs
+++ b/core/embed/rust/src/micropython/simple_type.rs
@@ -1,5 +1,5 @@
use super::obj::{Obj, ObjBase};
-use super::typ::Type;
+use super::typ::FullType;
/// Simple MicroPython object type builder.
///
@@ -24,9 +24,11 @@ pub struct SimpleTypeObj {
}
impl SimpleTypeObj {
- pub const fn new(base: &'static Type) -> Self {
+ // base would ideally be something like impl Into<&'static Type> but we don't
+ // have const traits and it's currently only used with FullType anyway
+ pub const fn new(base: &'static FullType) -> Self {
Self {
- base: base.as_base(),
+ base: base.as_type().as_base(),
}
}
diff --git a/core/embed/rust/src/micropython/typ.rs b/core/embed/rust/src/micropython/typ.rs
index dee138fb..95ee3437 100644
--- a/core/embed/rust/src/micropython/typ.rs
+++ b/core/embed/rust/src/micropython/typ.rs
@@ -1,3 +1,5 @@
+use core::ops::Deref;
+
use super::ffi;
use super::obj::{Obj, ObjBase};
@@ -33,3 +35,31 @@ impl Type {
// SAFETY: We are in a single-threaded environment.
unsafe impl Sync for Type {}
+
+/// Since Type has variable size due to its slots array, functions that
+/// construct type objects return this which is a Type with the maximum number
+/// of slots.
+pub type FullType = ffi::mp_obj_full_type_t;
+
+impl FullType {
+ pub const fn as_type(&self) -> &Type {
+ let type_ptr = self as *const Self as *const ffi::mp_obj_type_t;
+ // SAFETY:
+ // - aligned, non-null, and dereferanceable because it came from a reference
+ // - pointee is valid because the initial part of FullType has the same layout
+ // as Type
+ // - aliasing the same as source reference
+ unsafe { type_ptr.as_ref_unchecked() }
+ }
+}
+
+impl Deref for FullType {
+ type Target = Type;
+
+ fn deref(&self) -> &Type {
+ self.as_type()
+ }
+}
+
+// SAFETY: We are in a single-threaded environment.
+unsafe impl Sync for FullType {}
diff --git a/core/embed/rust/src/protobuf/obj.rs b/core/embed/rust/src/protobuf/obj.rs
index edadbc53..7d272c53 100644
--- a/core/embed/rust/src/protobuf/obj.rs
+++ b/core/embed/rust/src/protobuf/obj.rs
@@ -11,7 +11,7 @@ use crate::micropython::map::Map;
use crate::micropython::module::Module;
use crate::micropython::obj::{Obj, ObjBase};
use crate::micropython::qstr::Qstr;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::{FullType, Type};
use crate::micropython::{ffi, util};
#[repr(C)]
@@ -45,7 +45,7 @@ impl MsgObj {
}
fn obj_type() -> &'static Type {
- static TYPE: Type = obj_type! {
+ static TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_Msg,
attr_fn: msg_obj_attr,
};
@@ -165,7 +165,7 @@ impl MsgDefObj {
}
fn obj_type() -> &'static Type {
- static TYPE: Type = obj_type! {
+ static TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_MsgDef,
attr_fn: msg_def_obj_attr,
call_fn: msg_def_obj_call,
diff --git a/core/embed/rust/src/thp/micropython.rs b/core/embed/rust/src/thp/micropython.rs
index 3dfd8be5..53347a38 100644
--- a/core/embed/rust/src/thp/micropython.rs
+++ b/core/embed/rust/src/thp/micropython.rs
@@ -13,7 +13,7 @@ use crate::micropython::module::Module;
use crate::micropython::obj::Obj;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::FullType;
use crate::micropython::{exception, util};
extern "C" fn thp_init(iface_num: Obj, device_properties: Obj) -> Obj {
@@ -303,15 +303,15 @@ extern "C" fn thp_handshake_key(iface_num: Obj, local_static_privkey: Obj) -> Ob
}
#[allow(non_upper_case_globals)]
-pub static ThpError: Type =
+pub static ThpError: FullType =
exception::define_exception(Qstr::MP_QSTR_ThpError, exception::Exception);
-static FAILED_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_FAILED, };
-static KEY_REQUIRED_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_KEY_REQUIRED, };
-static KEY_REQUIRED_UNLOCK_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_KEY_REQUIRED_UNLOCK, };
-static MESSAGE_READY_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_MESSAGE_READY, };
-static ACK_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_ACK, };
-static MESSAGE_READY_ACK_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_MESSAGE_READY_ACK, };
+static FAILED_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_FAILED, };
+static KEY_REQUIRED_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_KEY_REQUIRED, };
+static KEY_REQUIRED_UNLOCK_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_KEY_REQUIRED_UNLOCK, };
+static MESSAGE_READY_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_MESSAGE_READY, };
+static ACK_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_ACK, };
+static MESSAGE_READY_ACK_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_MESSAGE_READY_ACK, };
pub static FAILED_OBJ: SimpleTypeObj = SimpleTypeObj::new(&FAILED_TYPE);
pub static KEY_REQUIRED_OBJ: SimpleTypeObj = SimpleTypeObj::new(&KEY_REQUIRED_TYPE);
@@ -359,7 +359,7 @@ pub static mp_module_trezorthp: Module = obj_module! {
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorthp.to_obj(),
/// ThpError: type[Exception]
- Qstr::MP_QSTR_ThpError => ThpError.as_obj(),
+ Qstr::MP_QSTR_ThpError => ThpError.as_type().as_obj(),
/// MESSAGE_READY: object
Qstr::MP_QSTR_MESSAGE_READY => MESSAGE_READY_OBJ.as_obj(),
diff --git a/core/embed/rust/src/translations/obj.rs b/core/embed/rust/src/translations/obj.rs
index 5c18d5c9..33cadf94 100644
--- a/core/embed/rust/src/translations/obj.rs
+++ b/core/embed/rust/src/translations/obj.rs
@@ -10,7 +10,7 @@ use crate::micropython::module::Module;
use crate::micropython::obj::Obj;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::FullType;
use crate::micropython::{ffi, util};
use crate::trezorhal::translations;
@@ -37,7 +37,7 @@ unsafe extern "C" fn tr_attr_fn(_self_in: Obj, attr: ffi::qstr, dest: *mut Obj)
unsafe { util::try_or_raise(block) }
}
-static TR_TYPE: Type = obj_type! {
+static TR_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_TR,
attr_fn: tr_attr_fn,
};
@@ -85,7 +85,7 @@ pub extern "C" fn translations_header_from_flash(_cls_in: Obj) -> Obj {
unsafe { util::try_or_raise(block) }
}
-static TRANSLATIONS_HEADER_TYPE: Type = obj_type! {
+static TRANSLATIONS_HEADER_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_TranslationsHeader,
locals: &obj_dict!(obj_map! {
Qstr::MP_QSTR_load_from_flash => obj_fn_1!(translations_header_from_flash).as_obj(),
diff --git a/core/embed/rust/src/trezorhal/ble/micropython.rs b/core/embed/rust/src/trezorhal/ble/micropython.rs
index 7bbc55b5..49748d66 100644
--- a/core/embed/rust/src/trezorhal/ble/micropython.rs
+++ b/core/embed/rust/src/trezorhal/ble/micropython.rs
@@ -9,7 +9,7 @@ use crate::micropython::module::Module;
use crate::micropython::obj::Obj;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::FullType;
use crate::micropython::util;
extern "C" fn py_erase_bonds() -> Obj {
@@ -261,7 +261,7 @@ extern "C" fn py_iface_read(n_args: usize, args: *const Obj) -> Obj {
unsafe { util::try_with_args_and_kwargs(n_args, args, &Map::EMPTY, block) }
}
-static BLE_INTERFACE_TYPE: Type = obj_type! {
+static BLE_INTERFACE_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_BLEIF,
locals: &obj_dict!(obj_map! {
Qstr::MP_QSTR_iface_num => obj_fn_1!(py_iface_num).as_obj(),
diff --git a/core/embed/rust/src/ui/backlight.rs b/core/embed/rust/src/ui/backlight.rs
index d5415c6a..65ddf805 100644
--- a/core/embed/rust/src/ui/backlight.rs
+++ b/core/embed/rust/src/ui/backlight.rs
@@ -3,7 +3,7 @@ use crate::micropython::macros::obj_type;
use crate::micropython::obj::Obj;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::FullType;
use crate::micropython::{ffi, util};
use crate::ui::{CommonUI, ModelUI};
@@ -16,7 +16,7 @@ use crate::ui::{CommonUI, ModelUI};
* things stay forever. Written in May 2024.)
*/
-static BACKLIGHT_LEVELS_TYPE: Type = obj_type! {
+static BACKLIGHT_LEVELS_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_BacklightLevels,
attr_fn: backlight_levels_attr,
};
diff --git a/core/embed/rust/src/ui/layout/base.rs b/core/embed/rust/src/ui/layout/base.rs
index d42c0de9..833add7a 100644
--- a/core/embed/rust/src/ui/layout/base.rs
+++ b/core/embed/rust/src/ui/layout/base.rs
@@ -25,26 +25,26 @@ mod micropython {
use crate::micropython::obj::Obj;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
- use crate::micropython::typ::Type;
+ use crate::micropython::typ::FullType;
- static STATE_INITIAL_TYPE: Type = obj_type! {
+ static STATE_INITIAL_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_INITIAL,
- base: LAYOUT_STATE_TYPE,
+ base: LAYOUT_STATE_TYPE.as_type(),
};
- static STATE_ATTACHED_TYPE: Type = obj_type! {
+ static STATE_ATTACHED_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_ATTACHED,
- base: LAYOUT_STATE_TYPE,
+ base: LAYOUT_STATE_TYPE.as_type(),
};
- static STATE_TRANSITIONING_TYPE: Type = obj_type! {
+ static STATE_TRANSITIONING_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_TRANSITIONING,
- base: LAYOUT_STATE_TYPE,
+ base: LAYOUT_STATE_TYPE.as_type(),
};
- static STATE_DONE_TYPE: Type = obj_type! {
+ static STATE_DONE_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_DONE,
- base: LAYOUT_STATE_TYPE,
+ base: LAYOUT_STATE_TYPE.as_type(),
};
pub static STATE_INITIAL: SimpleTypeObj = SimpleTypeObj::new(&STATE_INITIAL_TYPE);
@@ -52,7 +52,7 @@ mod micropython {
pub static STATE_TRANSITIONING: SimpleTypeObj = SimpleTypeObj::new(&STATE_TRANSITIONING_TYPE);
pub static STATE_DONE: SimpleTypeObj = SimpleTypeObj::new(&STATE_DONE_TYPE);
- static LAYOUT_STATE_TYPE: Type = obj_type! {
+ static LAYOUT_STATE_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_LayoutState,
locals: &obj_dict! { obj_map! {
Qstr::MP_QSTR_INITIAL => STATE_INITIAL.as_obj(),
diff --git a/core/embed/rust/src/ui/layout/device_menu_result.rs b/core/embed/rust/src/ui/layout/device_menu_result.rs
index a31471e6..d0d48449 100644
--- a/core/embed/rust/src/ui/layout/device_menu_result.rs
+++ b/core/embed/rust/src/ui/layout/device_menu_result.rs
@@ -3,7 +3,7 @@ use crate::micropython::macros::obj_type;
use crate::micropython::obj::Obj;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::FullType;
use crate::micropython::{ffi, util};
#[derive(Copy, Clone)]
@@ -87,7 +87,7 @@ impl DeviceMenuMsg {
}
// Create a DeviceMenuResult class that contains all result types
-static DEVICE_MENU_RESULT_TYPE: Type = obj_type! {
+static DEVICE_MENU_RESULT_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_DeviceMenuResult,
attr_fn: device_menu_result_attr,
};
diff --git a/core/embed/rust/src/ui/layout/obj.rs b/core/embed/rust/src/ui/layout/obj.rs
index 09eb5852..94e57beb 100644
--- a/core/embed/rust/src/ui/layout/obj.rs
+++ b/core/embed/rust/src/ui/layout/obj.rs
@@ -19,7 +19,7 @@ use crate::micropython::map::Map;
use crate::micropython::obj::{Obj, ObjBase};
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::{FullType, Type};
use crate::micropython::util;
use crate::time::Duration;
use crate::ui::button_request::ButtonRequest;
@@ -70,7 +70,7 @@ impl AttachType {
}
}
-static ATTACH_TYPE: Type = obj_type! {
+static ATTACH_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_AttachType,
locals: &obj_dict!(obj_map! {
Qstr::MP_QSTR_INITIAL => Obj::small_int(0u16),
@@ -395,7 +395,7 @@ impl LayoutObj {
}
fn obj_type() -> &'static Type {
- static TYPE: Type = obj_type! {
+ static TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_LayoutObj,
locals: &obj_dict!(obj_map! {
Qstr::MP_QSTR_attach_timer_fn => obj_fn_3!(ui_layout_attach_timer_fn).as_obj(),
diff --git a/core/embed/rust/src/ui/layout/result.rs b/core/embed/rust/src/ui/layout/result.rs
index 4e3f470c..bec286d3 100644
--- a/core/embed/rust/src/ui/layout/result.rs
+++ b/core/embed/rust/src/ui/layout/result.rs
@@ -1,12 +1,12 @@
use crate::micropython::macros::obj_type;
use crate::micropython::qstr::Qstr;
use crate::micropython::simple_type::SimpleTypeObj;
-use crate::micropython::typ::Type;
+use crate::micropython::typ::FullType;
-static CONFIRMED_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_CONFIRMED, };
-static CANCELLED_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_CANCELLED, };
-static BACK_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_BACK, };
-static INFO_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_INFO, };
+static CONFIRMED_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_CONFIRMED, };
+static CANCELLED_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_CANCELLED, };
+static BACK_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_BACK, };
+static INFO_TYPE: FullType = obj_type! { name: Qstr::MP_QSTR_INFO, };
pub static CONFIRMED: SimpleTypeObj = SimpleTypeObj::new(&CONFIRMED_TYPE);
pub static CANCELLED: SimpleTypeObj = SimpleTypeObj::new(&CANCELLED_TYPE);
diff --git a/core/embed/rust/src/ui/notification.rs b/core/embed/rust/src/ui/notification.rs
index 53eb66cf..dfc6fcd0 100644
--- a/core/embed/rust/src/ui/notification.rs
+++ b/core/embed/rust/src/ui/notification.rs
@@ -5,7 +5,7 @@ use crate::micropython::{
obj::Obj,
qstr::Qstr,
simple_type::SimpleTypeObj,
- typ::Type,
+ typ::FullType,
};
use crate::strutil::TString;
@@ -67,7 +67,7 @@ impl TryFrom<Obj> for NotificationLevel {
}
#[cfg(feature = "micropython")]
-static NOTIFICATION_LEVEL_TYPE: Type = obj_type! {
+static NOTIFICATION_LEVEL_TYPE: FullType = obj_type! {
name: Qstr::MP_QSTR_NotificationLevel,
locals: &obj_dict!(obj_map! {
Qstr::MP_QSTR_ALERT => Obj::small_int(0),
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.