diff --git a/rust/src/disassembly.rs b/rust/src/disassembly.rs index 1fd51cee9..688a5374f 100644 --- a/rust/src/disassembly.rs +++ b/rust/src/disassembly.rs @@ -268,28 +268,28 @@ impl Drop for InstructionTextToken { impl CoreArrayProvider for InstructionTextToken { type Raw = BNInstructionTextToken; type Context = (); - type Wrapped<'a> = Self; + type Wrapped<'a> = &'a Self; } unsafe impl CoreArrayProviderInner for InstructionTextToken { unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { BNFreeInstructionText(raw, count) } unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { - Self(*raw) + core::mem::transmute(raw) } } impl CoreArrayProvider for Array { type Raw = BNInstructionTextLine; type Context = (); - type Wrapped<'a> = Self; + type Wrapped<'a> = mem::ManuallyDrop; } unsafe impl CoreArrayProviderInner for Array { unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { BNFreeInstructionTextLines(raw, count) } unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { - Self::new(raw.tokens, raw.count, ()) + mem::ManuallyDrop::new(Self::new(raw.tokens, raw.count, ())) } }