diff options
| author | bors <bors@rust-lang.org> | 2023-07-14 10:14:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-14 10:14:06 +0000 |
| commit | 01c842acfa2eb6cd7f364af192c246de62e0acab (patch) | |
| tree | 1e5ee88c8d93b8dee702e58e75114f6d3dea9f90 | |
| parent | ad9b7b56a4888badde7c1516d7e8a2b3fb994fe4 (diff) | |
| parent | 40cef615c02efcab2e42e771b55fb386b3f53383 (diff) | |
| download | rust-01c842acfa2eb6cd7f364af192c246de62e0acab.tar.gz rust-01c842acfa2eb6cd7f364af192c246de62e0acab.zip | |
Auto merge of #2980 - RalfJung:span, r=RalfJung
work around custom_mir span Cc https://github.com/rust-lang/rust/issues/113549
| -rw-r--r-- | src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs | 6 | ||||
| -rw-r--r-- | src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr | 13 |
2 files changed, 6 insertions, 13 deletions
diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs index 8eda913feb4..093b55759fd 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs @@ -5,9 +5,9 @@ pub struct S(i32); #[custom_mir(dialect = "runtime", phase = "optimized")] fn main() { - // FIXME: the span is not great (probably caused by custom MIR) - mir! { //~ERROR: uninitialized + mir! { let unit: (); + let _observe: i32; { let non_copy = S(42); // This could change `non_copy` in-place @@ -15,7 +15,7 @@ fn main() { } after_call = { // So now we must not be allowed to observe non-copy again. - let _observe = non_copy.0; + _observe = non_copy.0; //~ERROR: uninitialized Return() } diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr index 3ff7976c70b..5d9a3af0c8a 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr @@ -1,20 +1,13 @@ error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory --> $DIR/arg_inplace_observe_after.rs:LL:CC | -LL | / mir! { -LL | | let unit: (); -LL | | { -LL | | let non_copy = S(42); -... | -LL | | -LL | | } - | |_____^ using uninitialized data, but this operation requires initialized memory +LL | _observe = non_copy.0; + | ^^^^^^^^^^^^^^^^^^^^^ 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 = note: BACKTRACE: - = note: inside `main` at RUSTLIB/core/src/intrinsics/mir.rs:LL:CC - = 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) + = note: inside `main` at $DIR/arg_inplace_observe_after.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace |
