]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #46833 - diwic:7c-abort-ffi, r=arielb1
authorbors <bors@rust-lang.org>
Sun, 24 Dec 2017 02:42:15 +0000 (02:42 +0000)
committerbors <bors@rust-lang.org>
Sun, 24 Dec 2017 02:42:15 +0000 (02:42 +0000)
Prevent unwinding past FFI boundaries

Second attempt to write a patch to solve this.

r? @nikomatsakis

~~So, my biggest issue with this patch is the way the patch determines *what* functions should have an abort landing pad (in `construct_fn`). I would ideally have this code match [src/librustc_trans/callee.rs::get_fn](https://github.com/rust-lang/rust/blob/master/src/librustc_trans/callee.rs#L107-L115) but couldn't find an id that returns true for `is_foreign_item`. Also tried `tcx.has_attr("unwind")` with no luck.~~ FIXED

Other issues:

 * llvm.trap is an SIGILL on amd64. Ideally we could use panic-abort's version of aborting which is nicer but we don't want to depend on that library...

 * ~~Mir inlining is a stub currently.~~ FIXED (no-op)

Also, when reviewing please take into account that I'm new to the code and only partially know what I'm doing... and that I've mostly made made matches on `TerminatorKind::Abort` match either `TerminatorKind::Resume` or `TerminatorKind::Unreachable` based on what looked best.

1  2 
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/build/mod.rs
src/librustc_mir/dataflow/impls/borrows.rs
src/librustc_mir/monomorphize/collector.rs

Simple merge
Simple merge