hermit: Fix fuzzy_provenance_casts

This commit is contained in:
Martin Kröning 2022-11-29 11:26:40 +01:00
parent 2585bcea0b
commit c8f3203c46

View File

@ -5,6 +5,7 @@
use crate::io; use crate::io;
use crate::mem; use crate::mem;
use crate::num::NonZeroUsize; use crate::num::NonZeroUsize;
use crate::ptr;
use crate::sys::hermit::abi; use crate::sys::hermit::abi;
use crate::sys::hermit::thread_local_dtor::run_dtors; use crate::sys::hermit::thread_local_dtor::run_dtors;
use crate::time::Duration; use crate::time::Duration;
@ -47,7 +48,7 @@ pub unsafe fn new_with_coreid(
extern "C" fn thread_start(main: usize) { extern "C" fn thread_start(main: usize) {
unsafe { unsafe {
// Finally, let's run some code. // Finally, let's run some code.
Box::from_raw(main as *mut Box<dyn FnOnce()>)(); Box::from_raw(ptr::from_exposed_addr::<Box<dyn FnOnce()>>(main).cast_mut())();
// run all destructors // run all destructors
run_dtors(); run_dtors();