rust/compiler/rustc_codegen_llvm/src
bors 51e514c0fb Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb
Add -Z panic-in-drop={unwind,abort} command-line option

This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits:
- The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked.
- A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness:
  - https://github.com/servo/rust-smallvec/issues/14
  - https://github.com/bluss/arrayvec/issues/3
- There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc.
  - Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`).

One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind.

cc https://github.com/rust-lang/lang-team/issues/97
2021-09-12 20:48:09 +00:00
..
back Move add_rlib and add_native_library to cg_ssa 2021-09-01 14:43:27 +02:00
coverageinfo Auto merge of #85178 - cjgillot:local-crate, r=oli-obk 2021-05-17 01:42:03 +00:00
debuginfo Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
llvm Handle SrcMgr diagnostics 2021-08-16 18:28:17 +02:00
abi.rs Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb 2021-09-12 20:48:09 +00:00
allocator.rs Include debug info for the allocator shim 2021-08-31 15:24:20 -07:00
asm.rs Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
attributes.rs Add support for leaf fn frame pointer elimination 2021-06-30 19:45:17 +03:00
base.rs Always use llvm.used for coverage symbols 2021-08-21 10:08:05 +02:00
builder.rs rename is_valid_for to is_valid 2021-09-09 10:41:19 +02:00
callee.rs Fix static relocation model for PowerPC64 2021-05-28 03:48:39 +02:00
common.rs Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
consts.rs Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
context.rs ty::layout: split LayoutOf into required and (blanket) provided halves. 2021-09-02 01:17:14 +03:00
declare.rs Remove the decl arg from FnAbi::llvm_type 2021-08-05 10:58:55 -07:00
intrinsic.rs Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
lib.rs Include debug info for the allocator shim 2021-08-31 15:24:20 -07:00
llvm_util.rs Revert machine outliner disabling on LLVM 13 2021-08-28 15:11:46 +08:00
mono_item.rs rustc_target: move LayoutOf to ty::layout. 2021-09-02 01:17:14 +03:00
type_.rs Auto merge of #87254 - rusticstuff:rustc_codegen_llvm_dont_emit_zero_sized_padding, r=eddyb 2021-08-11 01:36:23 +00:00
type_of.rs Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
va_arg.rs rustc_target: move LayoutOf to ty::layout. 2021-09-02 01:17:14 +03:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00