Skip to content

Commit

Permalink
Auto merge of #2135 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
rustup
  • Loading branch information
bors committed May 20, 2022
2 parents d419efd + 8b4d613 commit b96610b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f24ef2e296ec6fc6fd2e24d7e4bfec3f4cb0577a
22ee39504a702f75485582d02060495a01254de1
7 changes: 6 additions & 1 deletion src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,12 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
}

#[inline(always)]
fn enforce_number_validity(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
fn enforce_number_init(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
ecx.machine.enforce_number_validity
}

#[inline(always)]
fn enforce_number_no_provenance(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
ecx.machine.enforce_number_validity
}

Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/ptr_integer_transmute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

fn main() {
let r = &mut 42;
let _i: usize = unsafe { std::mem::transmute(r) }; //~ ERROR expected initialized plain (non-pointer) bytes
let _i: usize = unsafe { std::mem::transmute(r) }; //~ ERROR expected plain (non-pointer) bytes
}
2 changes: 1 addition & 1 deletion tests/compile-fail/strict_provenance_transmute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::mem;
// <https://github.com/rust-lang/unsafe-code-guidelines/issues/286#issuecomment-1085144431>.

unsafe fn deref(left: *const u8, right: *const u8) {
let left_int: usize = mem::transmute(left); //~ERROR expected initialized plain (non-pointer) bytes
let left_int: usize = mem::transmute(left); //~ERROR expected plain (non-pointer) bytes
let right_int: usize = mem::transmute(right);
if left_int == right_int {
// The compiler is allowed to replace `left_int` by `right_int` here...
Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/uninit_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

fn main() {
let _val = unsafe { std::mem::MaybeUninit::<f32>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
}
2 changes: 1 addition & 1 deletion tests/compile-fail/uninit_integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

fn main() {
let _val = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
}
2 changes: 1 addition & 1 deletion tests/compile-fail/uninit_integer_signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

fn main() {
let _val = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
}

0 comments on commit b96610b

Please sign in to comment.