Use proper intrinsic type

This commit is contained in:
Aaron Hill 2019-10-29 18:48:29 -04:00
parent 848e1d827e
commit 5553476d49
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
3 changed files with 5 additions and 9 deletions

View File

@ -1352,12 +1352,7 @@ pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
/// Internal hook used by Miri to implement unwinding.
/// Perma-unstable: do not use
#[cfg(not(bootstrap))]
// Note that the type is data is pretty arbitrary:
// we just need something that's guarnateed to be a fat
// pointer. Using `*mut [()]` instead of the actual type
// `*mut (Any + Send)` allows us to avoid making `Any` and `Send`
// lang items
pub fn miri_start_panic(data: *mut [()]) -> !;
pub fn miri_start_panic(data: *mut (dyn crate::any::Any + crate::marker::Send)) -> !;
}
// Some functions are defined here because they accidentally got made

View File

@ -6,8 +6,7 @@ pub fn payload() -> *mut u8 {
}
pub unsafe fn panic(data: Box<dyn Any + Send>) -> ! {
let raw_val: *mut [()] = core::mem::transmute::<*mut (dyn Any + Send), _>(Box::into_raw(data));
core::intrinsics::miri_start_panic(raw_val)
core::intrinsics::miri_start_panic(Box::into_raw(data))
}
pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {

View File

@ -385,7 +385,9 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem) {
}
"miri_start_panic" => {
(0, vec![tcx.mk_mut_ptr(tcx.mk_slice(tcx.mk_unit()))], tcx.types.never)
// TODO - the relevant types aren't lang items,
// so it's not trivial to check this
return;
}
ref other => {