Skip to content

Commit

Permalink
Merge from rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
The Miri Cronjob Bot committed Jun 21, 2024
2 parents a4b9cea + 74cf63c commit 72ae31c
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 10 deletions.
2 changes: 0 additions & 2 deletions tests/fail/function_calls/exported_symbol_bad_unwind1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(c_unwind)]

#[no_mangle]
extern "C-unwind" fn unwind() {
panic!();
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/function_calls/exported_symbol_bad_unwind2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
//@[definition,both]error-in-other-file: aborted execution
#![feature(rustc_attrs, c_unwind)]
#![feature(rustc_attrs)]

#[cfg_attr(any(definition, both), rustc_nounwind)]
#[no_mangle]
Expand Down
2 changes: 0 additions & 2 deletions tests/fail/panic/bad_unwind.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(c_unwind)]

//! Unwinding when the caller ABI is "C" (without "-unwind") is UB.
// The opposite version (callee does not allow unwinding) is impossible to
// even write: MIR validation catches functions that have `UnwindContinue` but
Expand Down
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

2 changes: 0 additions & 2 deletions tests/fail/terminate-terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// Enable MIR inlining to ensure that `TerminatorKind::UnwindTerminate` is generated
// instead of just `UnwindAction::Terminate`.

#![feature(c_unwind)]

struct Foo;

impl Drop for Foo {
Expand Down
2 changes: 0 additions & 2 deletions tests/fail/unwind-action-terminate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
//@normalize-stderr-test: "\| +\^+" -> "| ^"
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
#![feature(c_unwind)]

extern "C" fn panic_abort() {
panic!()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/panic/function_calls/exported_symbol_good_unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// found in this form" errors works without `-C prefer-dynamic` (`panic!` calls foreign function
// `__rust_start_panic`).
// no-prefer-dynamic
#![feature(c_unwind, unboxed_closures)]
#![feature(unboxed_closures)]

use std::panic;

Expand Down

0 comments on commit 72ae31c

Please sign in to comment.