Skip to content
Permalink
Browse files

honor unwind attribute even for Rust Abi

  • Loading branch information...
RalfJung committed Aug 25, 2019
1 parent 9ac1dd2 commit 0cf08126b7aab7c87d2c01e998a2f03bd3b1bdec
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/librustc/ty/context.rs
@@ -1586,9 +1586,6 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn abort_on_panic_shim(&self, fn_def_id: DefId, abi: abi::Abi) -> bool {
use abi::Abi;

// Not callable from C, so we can safely unwind through these
if abi == Abi::Rust || abi == Abi::RustCall { return false; }

// Validate `#[unwind]` syntax regardless of platform-specific panic strategy
let attrs = &self.get_attrs(fn_def_id);
let unwind_attr = attr::find_unwind_attr(Some(self.sess.diagnostic()), attrs);
@@ -1602,7 +1599,9 @@ impl<'tcx> TyCtxt<'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 =>
// Default: everything but Rust gets a shim.
abi != Abi::Rust && abi != Abi::RustCall,
Some(attr::UnwindAttr::Allowed) => false,
Some(attr::UnwindAttr::Aborts) => true,
}

0 comments on commit 0cf0812

Please sign in to comment.
You can’t perform that action at this time.