Skip to content

Commit 5553476

Browse files
committed
Use proper intrinsic type
1 parent 848e1d8 commit 5553476

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/libcore/intrinsics.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,12 +1352,7 @@ extern "rust-intrinsic" {
13521352
/// Internal hook used by Miri to implement unwinding.
13531353
/// Perma-unstable: do not use
13541354
#[cfg(not(bootstrap))]
1355-
// Note that the type is data is pretty arbitrary:
1356-
// we just need something that's guarnateed to be a fat
1357-
// pointer. Using `*mut [()]` instead of the actual type
1358-
// `*mut (Any + Send)` allows us to avoid making `Any` and `Send`
1359-
// lang items
1360-
pub fn miri_start_panic(data: *mut [()]) -> !;
1355+
pub fn miri_start_panic(data: *mut (dyn crate::any::Any + crate::marker::Send)) -> !;
13611356
}
13621357

13631358
// Some functions are defined here because they accidentally got made

src/libpanic_unwind/miri.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ pub fn payload() -> *mut u8 {
66
}
77

88
pub unsafe fn panic(data: Box<dyn Any + Send>) -> ! {
9-
let raw_val: *mut [()] = core::mem::transmute::<*mut (dyn Any + Send), _>(Box::into_raw(data));
10-
core::intrinsics::miri_start_panic(raw_val)
9+
core::intrinsics::miri_start_panic(Box::into_raw(data))
1110
}
1211

1312
pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {

src/librustc_typeck/check/intrinsic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,9 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem) {
385385
}
386386

387387
"miri_start_panic" => {
388-
(0, vec![tcx.mk_mut_ptr(tcx.mk_slice(tcx.mk_unit()))], tcx.types.never)
388+
// TODO - the relevant types aren't lang items,
389+
// so it's not trivial to check this
390+
return;
389391
}
390392

391393
ref other => {

0 commit comments

Comments
 (0)