Skip to content

Commit 8a4709f

Browse files
committed
Auto merge of #125912 - nnethercote:rustfmt-tests-mir-opt, r=oli-obk
rustfmt `tests/mir-opt` Continuing the work started in #125759. Details in individual commit log messages. r? `@oli-obk`
2 parents 8933674 + 017033e commit 8a4709f

6 files changed

+24
-18
lines changed

tests/fail/intrinsics/ptr_metadata_uninit_slice_data.rs

+6-4
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

+2-2
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

+6-4
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

+2-2
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

+6-4
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

+2-2
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

0 commit comments

Comments
 (0)