Auto merge of #1178 - RalfJung:rustup-visitor, r=RalfJung
adjust for rustc changes The Miri side of https://github.com/rust-lang/rust/pull/69257
This commit is contained in:
commit
7cdcdecb01
7 changed files with 9 additions and 12 deletions
|
|
@ -1 +1 @@
|
|||
e86c9e6ef8be7ddec0360f20aae7d86c69c59a83
|
||||
c839a7b4c26e58319b0c40448dd423facff34cd0
|
||||
|
|
|
|||
|
|
@ -300,18 +300,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||
}
|
||||
|
||||
// We have to do *something* for unions.
|
||||
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
|
||||
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>, fields: usize) -> InterpResult<'tcx> {
|
||||
assert!(fields > 0); // we should never reach "pseudo-unions" with 0 fields, like primitives
|
||||
|
||||
// With unions, we fall back to whatever the type says, to hopefully be consistent
|
||||
// with LLVM IR.
|
||||
// FIXME: are we consistent, and is this really the behavior we want?
|
||||
let frozen = self.ecx.type_is_freeze(v.layout.ty);
|
||||
if frozen { Ok(()) } else { (self.unsafe_cell_action)(v) }
|
||||
}
|
||||
|
||||
// We should never get to a primitive, but always short-circuit somewhere above.
|
||||
fn visit_primitive(&mut self, _v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
|
||||
bug!("we should always short-circuit before coming to a primitive")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ fn main() {
|
|||
let g: fn(*const i32) = unsafe { std::mem::transmute(f as fn(&i32)) };
|
||||
|
||||
g(0usize as *const i32)
|
||||
//~^ ERROR encountered 0, but expected something greater or equal to 1
|
||||
//~^ ERROR encountered a NULL reference
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ fn main() {
|
|||
let g: fn() -> &'static i32 = unsafe { std::mem::transmute(f as fn() -> *const i32) };
|
||||
|
||||
let _x = g();
|
||||
//~^ ERROR encountered 0, but expected something greater or equal to 1
|
||||
//~^ ERROR encountered a NULL reference
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ fn main() {
|
|||
let x : fn() = f;
|
||||
let y : *mut u8 = unsafe { mem::transmute(x) };
|
||||
let y = y.wrapping_offset(1);
|
||||
let _x : fn() = unsafe { mem::transmute(y) }; //~ ERROR encountered a potentially NULL pointer
|
||||
let _x : fn() = unsafe { mem::transmute(y) }; //~ ERROR encountered a pointer, but expected a function pointer
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
fn main() {
|
||||
let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR encountered 2, but expected something less or equal to 1
|
||||
let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR encountered 2, but expected a boolean
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
fn main() {
|
||||
assert!(std::char::from_u32(-1_i32 as u32).is_none());
|
||||
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered 4294967295, but expected something less or equal to 1114111
|
||||
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered 4294967295, but expected a valid unicode codepoint
|
||||
'a' => {true},
|
||||
'b' => {false},
|
||||
_ => {true},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue