Skip to content

Commit 23e3645

Browse files
authored
Merge pull request rust-lang#4644 from RalfJung/native-call-return-ptr
native_call: we only support thin pointers as return type
2 parents 86bb8eb + 424f7bf commit 23e3645

File tree

1 file changed

+2
-2
lines changed
  • src/tools/miri/src/shims/native_lib

1 file changed

+2
-2
lines changed

src/tools/miri/src/shims/native_lib/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use libffi::low::CodePtr;
77
use libffi::middle::Type as FfiType;
88
use rustc_abi::{HasDataLayout, Size};
99
use rustc_data_structures::either;
10-
use rustc_middle::ty::layout::TyAndLayout;
10+
use rustc_middle::ty::layout::{HasTypingEnv, TyAndLayout};
1111
use rustc_middle::ty::{self, IntTy, Ty, UintTy};
1212
use rustc_span::Symbol;
1313
use serde::{Deserialize, Serialize};
@@ -144,7 +144,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
144144
unsafe { ffi::call::<()>(fun, libffi_args) };
145145
return interp_ok(ImmTy::uninit(dest.layout));
146146
}
147-
ty::RawPtr(..) => {
147+
ty::RawPtr(ty, ..) if ty.is_sized(*this.tcx, this.typing_env()) => {
148148
let x = unsafe { ffi::call::<*const ()>(fun, libffi_args) };
149149
let ptr = StrictPointer::new(Provenance::Wildcard, Size::from_bytes(x.addr()));
150150
Scalar::from_pointer(ptr, this)

0 commit comments

Comments
 (0)