Skip to content

Commit

Permalink
Auto merge of #126679 - fmease:rollup-njrv2py, r=fmease
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

Successful merges:

 - #125447 (Allow constraining opaque types during subtyping in the trait system)
 - #125766 (MCDC Coverage: instrument last boolean RHS operands from condition coverage)
 - #125880 (Remove `src/tools/rust-demangler`)
 - #126154 (StorageLive: refresh storage (instead of UB) when local is already live)
 - #126572 (override user defined channel when using precompiled rustc)
 - #126662 (Unconditionally warn on usage of `wasm32-wasi`)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jun 19, 2024
2 parents be080ca + 4180fdd commit ec55015
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/fail/storage-live-dead-var.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![feature(core_intrinsics, custom_mir)]
use std::intrinsics::mir::*;

#[custom_mir(dialect = "runtime")]
fn main() {
mir! {
let val: i32;
{
val = 42; //~ERROR: accessing a dead local variable
StorageLive(val); // too late... (but needs to be here to make `val` not implicitly live)
Return()
}
}
}
15 changes: 15 additions & 0 deletions tests/fail/storage-live-dead-var.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: accessing a dead local variable
--> $DIR/storage-live-dead-var.rs:LL:CC
|
LL | val = 42;
| ^^^^^^^^ accessing a dead local variable
|
= 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 $DIR/storage-live-dead-var.rs:LL:CC

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

error: aborting due to 1 previous error

17 changes: 17 additions & 0 deletions tests/fail/storage-live-resets-var.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(core_intrinsics, custom_mir)]
use std::intrinsics::mir::*;

#[custom_mir(dialect = "runtime")]
fn main() {
mir! {
let val: i32;
let _val2: i32;
{
StorageLive(val);
val = 42;
StorageLive(val); // reset val to `uninit`
_val2 = val; //~ERROR: uninitialized
Return()
}
}
}
15 changes: 15 additions & 0 deletions tests/fail/storage-live-resets-var.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: Undefined Behavior: constructing invalid value: encountered uninitialized memory, but expected an integer
--> $DIR/storage-live-resets-var.rs:LL:CC
|
LL | _val2 = val;
| ^^^^^^^^^^^ constructing invalid value: encountered uninitialized memory, but expected an integer
|
= 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 $DIR/storage-live-resets-var.rs:LL:CC

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

error: aborting due to 1 previous error

0 comments on commit ec55015

Please sign in to comment.