rust/src/test
Alex Crichton 804666f4ad rustc: Tweak funclet cleanups of ffi functions
This commit is targeted at addressing #48251 by specifically fixing a case where
a longjmp over Rust frames on MSVC runs cleanups, accidentally running the
"abort the program" cleanup as well. Added in #46833 `extern` ABI functions in
Rust will abort the process if Rust panics, and currently this is modeled as a
normal cleanup like all other destructors.

Unfortunately it turns out that `longjmp` on MSVC is implemented with SEH, the
same mechanism used to implement panics in Rust. This means that `longjmp` over
Rust frames will run Rust cleanups (even though we don't necessarily want it
to). Notably this means that if you `longjmp` over a Rust stack frame then that
probably means you'll abort the program because one of the cleanups will abort
the process.

After some discussion on IRC it turns out that `longjmp` doesn't run cleanups
for *caught* exceptions, it only runs cleanups for cleanup pads. Using this
information this commit tweaks the codegen for an `extern` function to
a catch-all clause for exceptions instead of a cleanup block. This catch-all is
equivalent to the C++ code:

    try {
        foo();
    } catch (...) {
        bar();
    }

and in fact our codegen here is designed to match exactly what clang emits for
that C++ code!

With this tweak a longjmp over Rust code will no longer abort the process. A
longjmp will continue to "accidentally" run Rust cleanups (destructors) on MSVC.
Other non-MSVC platforms will not rust destructors with a longjmp, so we'll
probably still recommend "don't have destructors on the stack", but in any case
this is a more surgical fix than #48567 and should help us stick to standard
personality functions a bit longer.
2018-02-28 13:31:23 -08:00
..
auxiliary Remove directory src/rt 2018-02-24 16:45:39 +03:00
codegen rustc_mir: always run the deaggregator. 2018-02-20 02:50:26 +02:00
codegen-units Convert codegen-unit tests to use start instead of main 2017-12-26 12:26:39 +01:00
compile-fail Rollup merge of #48302 - mark-i-m:markim_macro-test, r=aturon 2018-02-25 15:54:46 +08:00
compile-fail-fulldeps Reexport -> re-export in prose and documentation comments 2018-01-15 13:36:53 -05:00
debuginfo Debuginfo Shadowed Variable test: fix check numbering 2018-01-06 11:10:17 +00:00
incremental rustc_mir: always run the deaggregator. 2018-02-20 02:50:26 +02:00
incremental-fulldeps Add incremental-fulldeps test suite and regression test for #47290. 2018-01-16 19:31:15 +01:00
mir-opt rustc_mir: optimize the deaggregator's expansion of statements. 2018-02-20 02:50:26 +02:00
parse-fail Auto merge of #47752 - mark-i-m:at-most-once-rep, r=nikomatsakis 2018-02-11 18:11:01 +00:00
pretty fix more typos found by codespell. 2018-02-17 17:38:49 +01:00
run-fail add test for fn main() -> ! 2018-02-22 20:10:36 -05:00
run-fail-fulldeps
run-make rustc: Tweak funclet cleanups of ffi functions 2018-02-28 13:31:23 -08:00
run-pass Auto merge of #48082 - jseyfried:improve_struct_field_hygiene, r=petrochenkov 2018-02-26 09:41:33 +00:00
run-pass-fulldeps fix more typos found by codespell. 2018-02-17 17:38:49 +01:00
run-pass-valgrind Add 'ignore-cloudabi' to tests that don't and won't build on CloudABI. 2018-01-02 14:11:41 +01:00
rustdoc Rollup merge of #48415 - QuietMisdreavus:traits-on-traits-on-traits, r=Manishearth 2018-02-24 15:52:11 -08:00
rustdoc-js Merge branch 'rustdoc_masked' of https://github.com/ollie27/rust into rollup 2018-01-26 06:51:58 -08:00
ui Auto merge of #48337 - GuillaumeGomez:rustc-explain, r=estebank 2018-02-26 12:34:52 +00:00
ui-fulldeps Reduce error codes length when too much are thrown 2018-02-25 12:15:05 +01:00
COMPILER_TESTS.md A few small improvements to the contributing docs 2017-12-20 22:18:13 +02:00