Skip to content

Commit 1ba794f

Browse files
committed
rustup
1 parent 7c40e0a commit 1ba794f

8 files changed

+21
-14
lines changed

Diff for: rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
94b2b15e63c5d2b2a6a0910e3dae554ce9415bf9
1+
4fd4de7ea358ad6fc28c5780533ea8ccc09e1006

Diff for: tests/fail/invalid_int.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(invalid_value)]
12
// Validation makes this fail in the wrong place
23
// Make sure we find these even with many checks disabled.
34
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation

Diff for: tests/fail/validity/uninit_float.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#![allow(deprecated)]
1+
#![allow(deprecated, invalid_value)]
22
// This test is adapted from https://github.com/rust-lang/miri/issues/1340#issue-600900312.
33

44
fn main() {
55
// Deliberately using `mem::uninitialized` to make sure that despite all the mitigations, we consider this UB.
6-
let _val: f32 = unsafe { std::mem::uninitialized() };
6+
// The array avoids a `Scalar` layout which detects uninit without even doing validation.
7+
let _val: [f32; 1] = unsafe { std::mem::uninitialized() };
78
//~^ ERROR: uninitialized
89
}

Diff for: tests/fail/validity/uninit_float.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized bytes
22
--> $DIR/uninit_float.rs:LL:CC
33
|
4-
LL | let _val: f32 = unsafe { std::mem::uninitialized() };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
4+
LL | let _val: [f32; 1] = unsafe { std::mem::uninitialized() };
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized bytes
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Diff for: tests/fail/validity/uninit_integer.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#![allow(invalid_value)]
12
// This test is from https://github.com/rust-lang/miri/issues/1340#issue-600900312.
23

34
fn main() {
4-
let _val = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() };
5+
// The array avoids a `Scalar` layout which detects uninit without even doing validation.
6+
let _val = unsafe { std::mem::MaybeUninit::<[usize; 1]>::uninit().assume_init() };
57
//~^ ERROR: uninitialized
68
}

Diff for: tests/fail/validity/uninit_integer.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized bytes
22
--> $DIR/uninit_integer.rs:LL:CC
33
|
4-
LL | let _val = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
4+
LL | let _val = unsafe { std::mem::MaybeUninit::<[usize; 1]>::uninit().assume_init() };
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized bytes
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Diff for: tests/fail/validity/uninit_raw_ptr.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
#![allow(invalid_value)]
2+
13
fn main() {
2-
let _val = unsafe { std::mem::MaybeUninit::<*const u8>::uninit().assume_init() };
4+
// The array avoids a `Scalar` layout which detects uninit without even doing validation.
5+
let _val = unsafe { std::mem::MaybeUninit::<[*const u8; 1]>::uninit().assume_init() };
36
//~^ ERROR: uninitialized
47
}

Diff for: tests/fail/validity/uninit_raw_ptr.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized memory, but expected a raw pointer
22
--> $DIR/uninit_raw_ptr.rs:LL:CC
33
|
4-
LL | let _val = unsafe { std::mem::MaybeUninit::<*const u8>::uninit().assume_init() };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
4+
LL | let _val = unsafe { std::mem::MaybeUninit::<[*const u8; 1]>::uninit().assume_init() };
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized memory, but expected a raw pointer
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)