From 2c48ce81a82436d2aff3e0d6b9169d83e33038bf Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sat, 8 Jul 2023 18:53:38 +0200 Subject: [PATCH] api/icd: drop static lifetime from `get_ref` return type This was never correct as the object pointed to can be destroyed at any moment. Signed-off-by: Karol Herbst Part-of: --- src/gallium/frontends/rusticl/api/icd.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/frontends/rusticl/api/icd.rs b/src/gallium/frontends/rusticl/api/icd.rs index a72a9fcf217..a0ede4cb640 100644 --- a/src/gallium/frontends/rusticl/api/icd.rs +++ b/src/gallium/frontends/rusticl/api/icd.rs @@ -231,7 +231,7 @@ pub trait ReferenceCountedAPIPointer { } } - fn get_ref(&self) -> CLResult<&'static T> { + fn get_ref(&self) -> CLResult<&T> { unsafe { Ok(self.get_ptr()?.as_ref().unwrap()) } } @@ -272,9 +272,9 @@ pub trait ReferenceCountedAPIPointer { Ok(res) } - fn get_ref_vec_from_arr(objs: *const Self, count: u32) -> CLResult> + fn get_ref_vec_from_arr<'a>(objs: *const Self, count: u32) -> CLResult> where - Self: Sized, + Self: Sized + 'a, { // CL spec requires validation for obj arrays, both values have to make sense if objs.is_null() && count > 0 || !objs.is_null() && count == 0 {