mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Automatically deallocate Failures in Rust
This commit is contained in:
parent
5d60677b5b
commit
9dea0e3a04
1 changed files with 16 additions and 0 deletions
|
@ -68,6 +68,22 @@ macro_rules! run_jit_function {
|
||||||
count: usize,
|
count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for Failures {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
use std::alloc::{dealloc, Layout};
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let layout = Layout::from_size_align_unchecked(
|
||||||
|
mem::size_of::<Failure>(),
|
||||||
|
mem::align_of::<Failure>(),
|
||||||
|
);
|
||||||
|
|
||||||
|
dealloc(self.failures as *mut u8, layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let get_expect_failures: libloading::Symbol<unsafe extern "C" fn() -> Failures> = $lib
|
let get_expect_failures: libloading::Symbol<unsafe extern "C" fn() -> Failures> = $lib
|
||||||
.get(bitcode::UTILS_GET_EXPECT_FAILURES.as_bytes())
|
.get(bitcode::UTILS_GET_EXPECT_FAILURES.as_bytes())
|
||||||
.ok()
|
.ok()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue