fix the panic error for riscv64 (#1123)

* fix the panic error for riscv64
This commit is contained in:
linfeng
2025-04-02 13:49:57 +08:00
committed by GitHub
parent 03015e2559
commit 91cc4adba9
15 changed files with 159 additions and 79 deletions

View File

@ -124,11 +124,11 @@ static mut CASTER_MAP: Option<HashMap<(TypeId, TypeId), BoxedCaster, BuildFastHa
#[cfg(target_os = "none")]
#[allow(static_mut_refs)]
pub fn caster_map() -> &'static HashMap<(TypeId, TypeId), BoxedCaster, BuildFastHasher> {
return unsafe {
unsafe {
CASTER_MAP.as_ref().unwrap_or_else(|| {
panic!("intertrait_caster_map() must be called after CASTER_MAP is initialized")
})
};
}
}
/// Initializes the global [`CASTER_MAP`] with [`CASTERS`].