Skip to content

Commit

Permalink
Auto merge of #125912 - nnethercote:rustfmt-tests-mir-opt, r=oli-obk
Browse files Browse the repository at this point in the history
rustfmt `tests/mir-opt`

Continuing the work started in #125759. Details in individual commit log messages.

r? `@oli-obk`
  • Loading branch information
bors committed Jun 3, 2024
2 parents 8933674 + 017033e commit 8a4709f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
10 changes: 6 additions & 4 deletions tests/fail/intrinsics/ptr_metadata_uninit_slice_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use std::intrinsics::mir::*;

#[custom_mir(dialect = "runtime")]
pub unsafe fn deref_meta(p: *const *const [i32]) -> usize {
mir!({
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
Return()
})
mir! {
{
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
Return()
}
}
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_metadata_uninit_slice_data.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
--> $DIR/ptr_metadata_uninit_slice_data.rs:LL:CC
|
LL | RET = PtrMetadata(*p);
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
LL | RET = PtrMetadata(*p);
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
10 changes: 6 additions & 4 deletions tests/fail/intrinsics/ptr_metadata_uninit_slice_len.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use std::intrinsics::mir::*;

#[custom_mir(dialect = "runtime")]
pub unsafe fn deref_meta(p: *const *const [i32]) -> usize {
mir!({
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
Return()
})
mir! {
{
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
Return()
}
}
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_metadata_uninit_slice_len.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ LL | (*p.as_mut_ptr().cast::<[*const i32; 2]>())[0] = 4 as *const i32;
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
--> $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC
|
LL | RET = PtrMetadata(*p);
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
LL | RET = PtrMetadata(*p);
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
10 changes: 6 additions & 4 deletions tests/fail/intrinsics/ptr_metadata_uninit_thin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use std::intrinsics::mir::*;

#[custom_mir(dialect = "runtime")]
pub unsafe fn deref_meta(p: *const *const i32) -> () {
mir!({
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
Return()
})
mir! {
{
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
Return()
}
}
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_metadata_uninit_thin.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
--> $DIR/ptr_metadata_uninit_thin.rs:LL:CC
|
LL | RET = PtrMetadata(*p);
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
LL | RET = PtrMetadata(*p);
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down

0 comments on commit 8a4709f

Please sign in to comment.