Skip to content

Commit

Permalink
Auto merge of rust-lang#102732 - RalfJung:assert_unsafe_precondition2…
Browse files Browse the repository at this point in the history
…, r=bjorn3

nicer errors from assert_unsafe_precondition

This makes the errors shown by cargo-careful nicer, and since `panic_no_unwind` is `nounwind noreturn` it hopefully doesn't have bad codegen impact. Thanks to `@bjorn3` for the hint!

Would be nice if we could somehow supply our own (static) message to print, currently it always prints `panic in a function that cannot unwind`. But still, this is better than before.
  • Loading branch information
bors committed Oct 12, 2022
2 parents a0c0085 + 06d565c commit 2530fe2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/fail/function_calls/exported_symbol_bad_unwind2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@revisions: extern_block definition both
#![feature(rustc_attrs, c_unwind)]

#[cfg_attr(any(definition, both), rustc_allocator_nounwind)]
#[cfg_attr(any(definition, both), rustc_nounwind)]
#[no_mangle]
extern "C-unwind" fn nounwind() {
//[definition]~^ ERROR: abnormal termination: the program aborted execution
Expand All @@ -11,7 +11,7 @@ extern "C-unwind" fn nounwind() {

fn main() {
extern "C-unwind" {
#[cfg_attr(any(extern_block, both), rustc_allocator_nounwind)]
#[cfg_attr(any(extern_block, both), rustc_nounwind)]
fn nounwind();
}
unsafe { nounwind() }
Expand Down

0 comments on commit 2530fe2

Please sign in to comment.