mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-13 18:37:33 +00:00
Auto merge of #2980 - RalfJung:span, r=RalfJung
work around custom_mir span Cc https://github.com/rust-lang/rust/issues/113549
This commit is contained in:
commit
01c842acfa
@ -5,9 +5,9 @@ pub struct S(i32);
|
|||||||
|
|
||||||
#[custom_mir(dialect = "runtime", phase = "optimized")]
|
#[custom_mir(dialect = "runtime", phase = "optimized")]
|
||||||
fn main() {
|
fn main() {
|
||||||
// FIXME: the span is not great (probably caused by custom MIR)
|
mir! {
|
||||||
mir! { //~ERROR: uninitialized
|
|
||||||
let unit: ();
|
let unit: ();
|
||||||
|
let _observe: i32;
|
||||||
{
|
{
|
||||||
let non_copy = S(42);
|
let non_copy = S(42);
|
||||||
// This could change `non_copy` in-place
|
// This could change `non_copy` in-place
|
||||||
@ -15,7 +15,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
after_call = {
|
after_call = {
|
||||||
// So now we must not be allowed to observe non-copy again.
|
// So now we must not be allowed to observe non-copy again.
|
||||||
let _observe = non_copy.0;
|
_observe = non_copy.0; //~ERROR: uninitialized
|
||||||
Return()
|
Return()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
|
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
|
||||||
--> $DIR/arg_inplace_observe_after.rs:LL:CC
|
--> $DIR/arg_inplace_observe_after.rs:LL:CC
|
||||||
|
|
|
|
||||||
LL | / mir! {
|
LL | _observe = non_copy.0;
|
||||||
LL | | let unit: ();
|
| ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
|
||||||
LL | | {
|
|
||||||
LL | | let non_copy = S(42);
|
|
||||||
... |
|
|
||||||
LL | |
|
|
||||||
LL | | }
|
|
||||||
| |_____^ 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: 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
|
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||||
= note: BACKTRACE:
|
= note: BACKTRACE:
|
||||||
= note: inside `main` at RUSTLIB/core/src/intrinsics/mir.rs:LL:CC
|
= note: inside `main` at $DIR/arg_inplace_observe_after.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: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user