Skip to content

Commit 7cdcdec

Browse files
committed
Auto merge of #1178 - RalfJung:rustup-visitor, r=RalfJung
adjust for rustc changes The Miri side of rust-lang/rust#69257
2 parents 64bfe81 + 88c45f9 commit 7cdcdec

File tree

7 files changed

+9
-12
lines changed

7 files changed

+9
-12
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e86c9e6ef8be7ddec0360f20aae7d86c69c59a83
1+
c839a7b4c26e58319b0c40448dd423facff34cd0

src/helpers.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
300300
}
301301

302302
// We have to do *something* for unions.
303-
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
303+
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>, fields: usize) -> InterpResult<'tcx> {
304+
assert!(fields > 0); // we should never reach "pseudo-unions" with 0 fields, like primitives
305+
304306
// With unions, we fall back to whatever the type says, to hopefully be consistent
305307
// with LLVM IR.
306308
// FIXME: are we consistent, and is this really the behavior we want?
307309
let frozen = self.ecx.type_is_freeze(v.layout.ty);
308310
if frozen { Ok(()) } else { (self.unsafe_cell_action)(v) }
309311
}
310-
311-
// We should never get to a primitive, but always short-circuit somewhere above.
312-
fn visit_primitive(&mut self, _v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
313-
bug!("we should always short-circuit before coming to a primitive")
314-
}
315312
}
316313
}
317314

tests/compile-fail/validity/cast_fn_ptr1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ fn main() {
77
let g: fn(*const i32) = unsafe { std::mem::transmute(f as fn(&i32)) };
88

99
g(0usize as *const i32)
10-
//~^ ERROR encountered 0, but expected something greater or equal to 1
10+
//~^ ERROR encountered a NULL reference
1111
}

tests/compile-fail/validity/cast_fn_ptr2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ fn main() {
77
let g: fn() -> &'static i32 = unsafe { std::mem::transmute(f as fn() -> *const i32) };
88

99
let _x = g();
10-
//~^ ERROR encountered 0, but expected something greater or equal to 1
10+
//~^ ERROR encountered a NULL reference
1111
}

tests/compile-fail/validity/fn_ptr_offset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ fn main() {
66
let x : fn() = f;
77
let y : *mut u8 = unsafe { mem::transmute(x) };
88
let y = y.wrapping_offset(1);
9-
let _x : fn() = unsafe { mem::transmute(y) }; //~ ERROR encountered a potentially NULL pointer
9+
let _x : fn() = unsafe { mem::transmute(y) }; //~ ERROR encountered a pointer, but expected a function pointer
1010
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fn main() {
2-
let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR encountered 2, but expected something less or equal to 1
2+
let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR encountered 2, but expected a boolean
33
}

tests/compile-fail/validity/invalid_char.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fn main() {
22
assert!(std::char::from_u32(-1_i32 as u32).is_none());
3-
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered 4294967295, but expected something less or equal to 1114111
3+
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered 4294967295, but expected a valid unicode codepoint
44
'a' => {true},
55
'b' => {false},
66
_ => {true},

0 commit comments

Comments
 (0)