mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-02 21:17:39 +00:00
Fix destructor return value in emcc.rs
This commit is contained in:
parent
8f60db8da8
commit
4f163afed6
@ -76,12 +76,20 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
|
|||||||
}
|
}
|
||||||
ptr::write(exception, Exception { data: Some(data) });
|
ptr::write(exception, Exception { data: Some(data) });
|
||||||
__cxa_throw(exception as *mut _, &EXCEPTION_TYPE_INFO, exception_cleanup);
|
__cxa_throw(exception as *mut _, &EXCEPTION_TYPE_INFO, exception_cleanup);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" fn exception_cleanup(ptr: *mut libc::c_void) {
|
// On WASM and ARM, the destructor returns the pointer to the object.
|
||||||
unsafe {
|
cfg_if::cfg_if! {
|
||||||
ptr::drop_in_place(ptr as *mut Exception);
|
if #[cfg(any(target_arch = "arm", target_arch = "wasm32"))] {
|
||||||
super::__rust_drop_panic();
|
type DestructorRet = *mut libc::c_void;
|
||||||
}
|
} else {
|
||||||
|
type DestructorRet = ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
extern "C" fn exception_cleanup(ptr: *mut libc::c_void) -> DestructorRet {
|
||||||
|
unsafe {
|
||||||
|
ptr::drop_in_place(ptr as *mut Exception);
|
||||||
|
super::__rust_drop_panic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +112,7 @@ extern "C" {
|
|||||||
fn __cxa_throw(
|
fn __cxa_throw(
|
||||||
thrown_exception: *mut libc::c_void,
|
thrown_exception: *mut libc::c_void,
|
||||||
tinfo: *const TypeInfo,
|
tinfo: *const TypeInfo,
|
||||||
dest: extern "C" fn(*mut libc::c_void),
|
dest: extern "C" fn(*mut libc::c_void) -> DestructorRet,
|
||||||
) -> !;
|
) -> !;
|
||||||
fn __gxx_personality_v0(
|
fn __gxx_personality_v0(
|
||||||
version: c_int,
|
version: c_int,
|
||||||
|
Loading…
Reference in New Issue
Block a user