Skip to content

Commit

Permalink
Rollup merge of #61569 - cuviper:beta-1.36-no-unwind-abort, r=Mark-Si…
Browse files Browse the repository at this point in the history
…mulacrum
  • Loading branch information
pietroalbini committed Jun 6, 2019
2 parents 1357c67 + 32cd647 commit afd3a02
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
// This is a special case: some functions have a C abi but are meant to
// unwind anyway. Don't stop them.
match unwind_attr {
None => true,
None => false, // FIXME(#58794)
Some(UnwindAttr::Allowed) => false,
Some(UnwindAttr::Aborts) => true,
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/codegen/c-variadic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![crate_type = "lib"]
#![feature(c_variadic)]
#![feature(unwind_attributes)]
#![no_std]
use core::ffi::VaList;

Expand All @@ -10,6 +11,7 @@ extern "C" {
fn foreign_c_variadic_1(_: VaList, ...);
}

#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_0() {
// Ensure that we correctly call foreign C-variadic functions.
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0)
Expand All @@ -24,20 +26,24 @@ pub unsafe extern "C" fn use_foreign_c_variadic_0() {

// Ensure that we do not remove the `va_list` passed to the foreign function when
// removing the "spoofed" `VaList` that is used by Rust defined C-variadics.
#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) {
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap)
foreign_c_variadic_1(ap);
}

#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) {
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 42)
foreign_c_variadic_1(ap, 42i32);
}
#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42)
foreign_c_variadic_1(ap, 2i32, 42i32);
}

#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) {
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42, i32 0)
foreign_c_variadic_1(ap, 2i32, 42i32, 0i32);
Expand Down
2 changes: 1 addition & 1 deletion src/test/incremental/hashes/function_interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub unsafe fn make_unsafe() {}
pub fn make_extern() {}

#[cfg(not(cfail1))]
#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, mir_built, typeck_tables_of, fn_sig")]
#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, typeck_tables_of, fn_sig")]
#[rustc_clean(cfg = "cfail3")]
pub extern "C" fn make_extern() {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/incremental/hashes/inherent_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl Foo {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
impl Foo {
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,mir_built,fn_sig,typeck_tables_of")]
#[rustc_clean(cfg="cfail2", except="Hir,HirBody,fn_sig,typeck_tables_of")]
#[rustc_clean(cfg="cfail3")]
pub extern fn make_method_extern(&self) { }
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass/abort-on-c-abi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(unused_must_use)]
#![feature(unwind_attributes)]
// Since we mark some ABIs as "nounwind" to LLVM, we must make sure that
// we never unwind through them.

Expand All @@ -11,6 +12,7 @@ use std::io::prelude::*;
use std::io;
use std::process::{Command, Stdio};

#[unwind(aborts)] // FIXME(#58794)
extern "C" fn panic_in_ffi() {
panic!("Test");
}
Expand Down

0 comments on commit afd3a02

Please sign in to comment.