Skip to content

Commit 3cac608

Browse files
committed
adjust code for copy_op changes
1 parent 3f63926 commit 3cac608

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/shims/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
6868
"volatile_load" => {
6969
let [place] = check_arg_count(args)?;
7070
let place = this.deref_operand(place)?;
71-
this.copy_op(&place.into(), dest)?;
71+
this.copy_op(&place.into(), dest, /*allow_transmute*/ false)?;
7272
}
7373
"volatile_store" => {
7474
let [place, dest] = check_arg_count(args)?;
7575
let place = this.deref_operand(place)?;
76-
this.copy_op(dest, &place.into())?;
76+
this.copy_op(dest, &place.into(), /*allow_transmute*/ false)?;
7777
}
7878

7979
"write_bytes" | "volatile_set_memory" => {

tests/pass/transmute_fat.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
fn main() {
55
// If we are careful, we can exploit data layout...
6+
// This is a tricky case since we are transmuting a ScalarPair type to a non-ScalarPair type.
67
let raw = unsafe { std::mem::transmute::<&[u8], [*const u8; 2]>(&[42]) };
78
let ptr: *const u8 = unsafe { std::mem::transmute_copy(&raw) };
89
assert_eq!(unsafe { *ptr }, 42);

0 commit comments

Comments
 (0)