From 9cd4ca94bfb021784842ea3eb057d2b469b18dd0 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Tue, 17 Dec 2024 13:34:43 +0100 Subject: [PATCH] Explicitly allow the static mut references where necessary --- rustler/src/resource/traits.rs | 2 ++ rustler/src/sys/functions.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/rustler/src/resource/traits.rs b/rustler/src/resource/traits.rs index ddb8552b..24fe09ec 100644 --- a/rustler/src/resource/traits.rs +++ b/rustler/src/resource/traits.rs @@ -12,6 +12,7 @@ type NifResourcePtr = *const ErlNifResourceType; static mut RESOURCE_TYPES: OnceLock> = OnceLock::new(); /// Register an Erlang resource type handle for a particular type given by its `TypeId` +#[allow(static_mut_refs)] pub(crate) unsafe fn register_resource_type(type_id: TypeId, resource_type: NifResourcePtr) { RESOURCE_TYPES.get_or_init(Default::default); RESOURCE_TYPES @@ -64,6 +65,7 @@ pub trait Resource: Sized + Send + Sync + 'static { #[doc(hidden)] pub(crate) trait ResourceExt: 'static { /// Get the NIF resource type handle for this type if it had been registered before + #[allow(static_mut_refs)] fn get_resource_type() -> Option { let map = unsafe { RESOURCE_TYPES.get()? }; map.get(&TypeId::of::()) diff --git a/rustler/src/sys/functions.rs b/rustler/src/sys/functions.rs index a81cdbe1..5b7eaca3 100644 --- a/rustler/src/sys/functions.rs +++ b/rustler/src/sys/functions.rs @@ -10,6 +10,7 @@ pub unsafe fn internal_set_symbols(callbacks: DynNifCallbacks) { DYN_NIF_CALLBACKS = callbacks; } +#[allow(static_mut_refs)] pub unsafe fn internal_write_symbols() { let filler = nif_filler::new(); DYN_NIF_CALLBACKS.write_symbols(filler);