From f3c1a3cb3cbdd25d5f556d1ab770f8cbc29fd567 Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Tue, 16 Apr 2024 17:03:20 -0300 Subject: add guard to array with unbound return types --- rust/src/references.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'rust/src/references.rs') diff --git a/rust/src/references.rs b/rust/src/references.rs index a30f3f5e..8b4ebb87 100644 --- a/rust/src/references.rs +++ b/rust/src/references.rs @@ -1,6 +1,6 @@ use crate::architecture::CoreArchitecture; use crate::function::Function; -use crate::rc::{CoreArrayProvider, CoreArrayWrapper, CoreOwnedArrayProvider, Ref}; +use crate::rc::{CoreArrayProvider, CoreArrayWrapper, CoreOwnedArrayProvider, Guard, Ref}; use binaryninjacore_sys::{BNFreeCodeReferences, BNFreeDataReferences, BNReferenceSource}; use std::mem::ManuallyDrop; @@ -65,12 +65,10 @@ unsafe impl CoreOwnedArrayProvider for CodeReference { } unsafe impl CoreArrayWrapper for CodeReference { - // TODO there is nothing blocking the returned value from out-living the - // array, change it to Guard? - type Wrapped<'a> = CodeReference; + type Wrapped<'a> = Guard<'a, CodeReference>; unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { - CodeReference::new(raw) + Guard::new(CodeReference::new(raw), &()) } } -- cgit v1.3.1