Skip to content

Commit b91f8d9

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents bf8216f + e69aeae commit b91f8d9

10 files changed

+41
-52
lines changed

tests/fail/intrinsics/ptr_metadata_uninit_slice_data.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ use std::intrinsics::mir::*;
77

88
#[custom_mir(dialect = "runtime")]
99
pub unsafe fn deref_meta(p: *const *const [i32]) -> usize {
10-
mir!({
11-
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
12-
Return()
13-
})
10+
mir! {
11+
{
12+
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
13+
Return()
14+
}
15+
}
1416
}
1517

1618
fn main() {

tests/fail/intrinsics/ptr_metadata_uninit_slice_data.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
22
--> $DIR/ptr_metadata_uninit_slice_data.rs:LL:CC
33
|
4-
LL | RET = PtrMetadata(*p);
5-
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
4+
LL | RET = PtrMetadata(*p);
5+
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
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

tests/fail/intrinsics/ptr_metadata_uninit_slice_len.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ use std::intrinsics::mir::*;
77

88
#[custom_mir(dialect = "runtime")]
99
pub unsafe fn deref_meta(p: *const *const [i32]) -> usize {
10-
mir!({
11-
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
12-
Return()
13-
})
10+
mir! {
11+
{
12+
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
13+
Return()
14+
}
15+
}
1416
}
1517

1618
fn main() {

tests/fail/intrinsics/ptr_metadata_uninit_slice_len.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ LL | (*p.as_mut_ptr().cast::<[*const i32; 2]>())[0] = 4 as *const i32;
1616
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1717
--> $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC
1818
|
19-
LL | RET = PtrMetadata(*p);
20-
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
19+
LL | RET = PtrMetadata(*p);
20+
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
2121
|
2222
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
2323
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/ptr_metadata_uninit_thin.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ use std::intrinsics::mir::*;
77

88
#[custom_mir(dialect = "runtime")]
99
pub unsafe fn deref_meta(p: *const *const i32) -> () {
10-
mir!({
11-
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
12-
Return()
13-
})
10+
mir! {
11+
{
12+
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
13+
Return()
14+
}
15+
}
1416
}
1517

1618
fn main() {

tests/fail/intrinsics/ptr_metadata_uninit_thin.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
22
--> $DIR/ptr_metadata_uninit_thin.rs:LL:CC
33
|
4-
LL | RET = PtrMetadata(*p);
5-
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
4+
LL | RET = PtrMetadata(*p);
5+
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
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

tests/fail/issue-miri-2432.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/fail/issue-miri-2432.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/pass/async-drop.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
//@revisions: stack tree
22
//@compile-flags: -Zmiri-strict-provenance
33
//@[tree]compile-flags: -Zmiri-tree-borrows
4+
5+
// WARNING: If you would ever want to modify this test,
6+
// please consider modifying rustc's async drop test at
7+
// `tests/ui/async-await/async-drop.rs`.
8+
49
#![feature(async_drop, impl_trait_in_assoc_type, noop_waker, async_closure)]
510
#![allow(incomplete_features, dead_code)]
611

tests/pass/drop_in_place.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Miri currently doesn't require types without drop glue to be
2+
// valid when dropped. This test confirms that behavior.
3+
// This is not a stable guarantee!
4+
5+
use std::ptr;
6+
7+
fn main() {
8+
let mut not_a_bool = 13u8;
9+
unsafe {
10+
ptr::drop_in_place(&mut not_a_bool as *mut u8 as *mut bool)
11+
};
12+
}

0 commit comments

Comments
 (0)