Skip to content

rustup #1752

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

Merged
merged 2 commits into from
Mar 25, 2021
Merged

rustup #1752

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 @@
5d04957a4b4714f71d38326fc96a0b0ef6dc5800
372afcf93bf60e1a9334b107cc3d72f1b0a4b1f4
3 changes: 2 additions & 1 deletion tests/compile-fail/dangling_pointers/dangling_zst_deref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Make sure we find these even with many checks disabled.
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0 -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation

fn main() {
let p = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0

fn main() {
// This pointer *could* be NULL so we cannot load from it, not even at ZST
let ptr = (&0u8 as *const u8).wrapping_sub(0x800) as *const ();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0

fn main() {
// This pointer *could* be NULL so we cannot load from it, not even at ZST.
// Not using the () type here, as writes of that type do not even have MIR generated.
Expand Down
3 changes: 3 additions & 0 deletions tests/compile-fail/null_pointer_deref_zst.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0

fn main() {
let x: () = unsafe { *std::ptr::null() }; //~ ERROR memory access failed: 0x0 is not a valid pointer
panic!("this should never print: {:?}", x);
Expand Down
3 changes: 3 additions & 0 deletions tests/compile-fail/null_pointer_write_zst.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0

fn main() {
// Not using the () type here, as writes of that type do not even have MIR generated.
// Also not assigning directly as that's array initialization, not assignment.
Expand Down
3 changes: 2 additions & 1 deletion tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This should fail even without validation
// compile-flags: -Zmiri-disable-validation
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0 -Zmiri-disable-validation

fn main() {
for i in 0..10 { // Try many times as this might work by chance.
Expand Down
3 changes: 3 additions & 0 deletions tests/compile-fail/zst2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0

fn main() {
// Not using the () type here, as writes of that type do not even have MIR generated.
// Also not assigning directly as that's array initialization, not assignment.
Expand Down
3 changes: 3 additions & 0 deletions tests/compile-fail/zst3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0

fn main() {
// Not using the () type here, as writes of that type do not even have MIR generated.
// Also not assigning directly as that's array initialization, not assignment.
Expand Down