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 <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24061>
This commit is contained in:
Karol Herbst 2023-07-08 18:53:38 +02:00 committed by Marge Bot
parent d653eb8a9a
commit 2c48ce81a8

View file

@ -231,7 +231,7 @@ pub trait ReferenceCountedAPIPointer<T, const ERR: i32> {
}
}
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<T, const ERR: i32> {
Ok(res)
}
fn get_ref_vec_from_arr(objs: *const Self, count: u32) -> CLResult<Vec<&'static T>>
fn get_ref_vec_from_arr<'a>(objs: *const Self, count: u32) -> CLResult<Vec<&'a T>>
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 {