Skip to content

Commit 01c842a

Browse files
committed
Auto merge of #2980 - RalfJung:span, r=RalfJung
work around custom_mir span Cc #113549
2 parents ad9b7b5 + 40cef61 commit 01c842a

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ pub struct S(i32);
55

66
#[custom_mir(dialect = "runtime", phase = "optimized")]
77
fn main() {
8-
// FIXME: the span is not great (probably caused by custom MIR)
9-
mir! { //~ERROR: uninitialized
8+
mir! {
109
let unit: ();
10+
let _observe: i32;
1111
{
1212
let non_copy = S(42);
1313
// This could change `non_copy` in-place
1414
Call(unit, after_call, change_arg(Move(non_copy)))
1515
}
1616
after_call = {
1717
// So now we must not be allowed to observe non-copy again.
18-
let _observe = non_copy.0;
18+
_observe = non_copy.0; //~ERROR: uninitialized
1919
Return()
2020
}
2121

src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
22
--> $DIR/arg_inplace_observe_after.rs:LL:CC
33
|
4-
LL | / mir! {
5-
LL | | let unit: ();
6-
LL | | {
7-
LL | | let non_copy = S(42);
8-
... |
9-
LL | |
10-
LL | | }
11-
| |_____^ using uninitialized data, but this operation requires initialized memory
4+
LL | _observe = non_copy.0;
5+
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
126
|
137
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
148
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
159
= note: BACKTRACE:
16-
= note: inside `main` at RUSTLIB/core/src/intrinsics/mir.rs:LL:CC
17-
= note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
= note: inside `main` at $DIR/arg_inplace_observe_after.rs:LL:CC
1811

1912
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
2013

0 commit comments

Comments
 (0)