diff options
| author | bors <bors@rust-lang.org> | 2021-08-04 21:09:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-04 21:09:53 +0000 |
| commit | 25b764849625cb090e8b81d12d2bb2295d073788 (patch) | |
| tree | efe79067b5e1b7146573c62d51082e562e451753 /src/test/ui/malformed | |
| parent | d54fbb98555c107fb62fb5ae1a5b8f4fc6ed3edc (diff) | |
| parent | bb68c66c40b7df475c79042d78dab9be3bb7ea00 (diff) | |
Auto merge of #86155 - alexcrichton:abort-on-unwind, r=nikomatsakis
rustc: Fill out remaining parts of C-unwind ABI This commit intends to fill out some of the remaining pieces of the C-unwind ABI. This has a number of other changes with it though to move this design space forward a bit. Notably contained within here is: * On `panic=unwind`, the `extern "C"` ABI is now considered as "may unwind". This fixes a longstanding soundness issue where if you `panic!()` in an `extern "C"` function defined in Rust that's actually UB because the LLVM representation for the function has the `nounwind` attribute, but then you unwind. * Whether or not a function unwinds now mainly considers the ABI of the function instead of first checking the panic strategy. This fixes a miscompile of `extern "C-unwind"` with `panic=abort` because that ABI can still unwind. * The aborting stub for non-unwinding ABIs with `panic=unwind` has been reimplemented. Previously this was done as a small tweak during MIR generation, but this has been moved to a separate and dedicated MIR pass. This new pass will, for appropriate functions and function calls, insert a `cleanup` landing pad for any function call that may unwind within a function that is itself not allowed to unwind. Note that this subtly changes some behavior from before where previously on an unwind which was caught-to-abort it would run active destructors in the function, and now it simply immediately aborts the process. * The `#[unwind]` attribute has been removed and all users in tests and such are now using `C-unwind` and `#![feature(c_unwind)]`. I think this is largely the last piece of the RFC to implement. Unfortunately I believe this is still not stabilizable as-is because activating the feature gate changes the behavior of the existing `extern "C"` ABI in a way that has no replacement. My thinking for how to enable this is that we add support for the `C-unwind` ABI on stable Rust first, and then after it hits stable we change the behavior of the `C` ABI. That way anyone straddling stable/beta/nightly can switch to `C-unwind` safely.
Diffstat (limited to 'src/test/ui/malformed')
| -rw-r--r-- | src/test/ui/malformed/malformed-unwind-1.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/malformed/malformed-unwind-1.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/malformed/malformed-unwind-2.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/malformed/malformed-unwind-2.stderr | 29 |
4 files changed, 0 insertions, 63 deletions
diff --git a/src/test/ui/malformed/malformed-unwind-1.rs b/src/test/ui/malformed/malformed-unwind-1.rs deleted file mode 100644 index 009695b177f..00000000000 --- a/src/test/ui/malformed/malformed-unwind-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(unwind_attributes)] - -#[unwind] //~ ERROR malformed `unwind` attribute -extern "C" fn f1() {} - -#[unwind = ""] //~ ERROR malformed `unwind` attribute -extern "C" fn f2() {} - -fn main() {} diff --git a/src/test/ui/malformed/malformed-unwind-1.stderr b/src/test/ui/malformed/malformed-unwind-1.stderr deleted file mode 100644 index 0a553e8a245..00000000000 --- a/src/test/ui/malformed/malformed-unwind-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: malformed `unwind` attribute input - --> $DIR/malformed-unwind-1.rs:3:1 - | -LL | #[unwind] - | ^^^^^^^^^ help: must be of the form: `#[unwind(allowed|aborts)]` - -error: malformed `unwind` attribute input - --> $DIR/malformed-unwind-1.rs:6:1 - | -LL | #[unwind = ""] - | ^^^^^^^^^^^^^^ help: must be of the form: `#[unwind(allowed|aborts)]` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/malformed/malformed-unwind-2.rs b/src/test/ui/malformed/malformed-unwind-2.rs deleted file mode 100644 index 9aafc7ca9b8..00000000000 --- a/src/test/ui/malformed/malformed-unwind-2.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(unwind_attributes)] - -#[unwind(allowed, aborts)] -//~^ ERROR malformed `unwind` attribute -extern "C" fn f1() {} - -#[unwind(unsupported)] -//~^ ERROR malformed `unwind` attribute -extern "C" fn f2() {} - -fn main() {} diff --git a/src/test/ui/malformed/malformed-unwind-2.stderr b/src/test/ui/malformed/malformed-unwind-2.stderr deleted file mode 100644 index 28512bf9ef1..00000000000 --- a/src/test/ui/malformed/malformed-unwind-2.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0633]: malformed `unwind` attribute input - --> $DIR/malformed-unwind-2.rs:3:1 - | -LL | #[unwind(allowed, aborts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid argument - | -help: the allowed arguments are `allowed` and `aborts` - | -LL | #[unwind(allowed)] - | -LL | #[unwind(aborts)] - | - -error[E0633]: malformed `unwind` attribute input - --> $DIR/malformed-unwind-2.rs:7:1 - | -LL | #[unwind(unsupported)] - | ^^^^^^^^^^^^^^^^^^^^^^ invalid argument - | -help: the allowed arguments are `allowed` and `aborts` - | -LL | #[unwind(allowed)] - | -LL | #[unwind(aborts)] - | - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0633`. |
