diff --git a/src/ref_counted.rs b/src/ref_counted.rs index f4f5b64..ce38647 100644 --- a/src/ref_counted.rs +++ b/src/ref_counted.rs @@ -131,7 +131,13 @@ impl RefCounted { /// Passes a pointer to [`RefCounted`] to the garbage collector. #[inline] pub(super) fn pass_to_collector(ptr: *mut Self) { - Collector::collect(Collector::current(), ptr as *mut dyn Collectible); + #[allow(clippy::transmute_ptr_to_ptr)] + let ptr = unsafe { + std::mem::transmute::<*mut (dyn Collectible + '_), *mut (dyn Collectible + 'static)>( + ptr, + ) + }; + Collector::collect(Collector::current(), ptr); } }