Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustup #2135

Merged
merged 1 commit into from
May 20, 2022
Merged

rustup #2135

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}