@@ -1182,37 +1182,6 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) ->
1182
1182
// ABIs have such an option. Otherwise the only other thing here is Rust
1183
1183
// itself, and those ABIs are determined by the panic strategy configured
1184
1184
// for this compilation.
1185
- //
1186
- // Unfortunately at this time there's also another caveat. Rust [RFC
1187
- // 2945][rfc] has been accepted and is in the process of being implemented
1188
- // and stabilized. In this interim state we need to deal with historical
1189
- // rustc behavior as well as plan for future rustc behavior.
1190
- //
1191
- // Historically functions declared with `extern "C"` were marked at the
1192
- // codegen layer as `nounwind`. This happened regardless of `panic=unwind`
1193
- // or not. This is UB for functions in `panic=unwind` mode that then
1194
- // actually panic and unwind. Note that this behavior is true for both
1195
- // externally declared functions as well as Rust-defined function.
1196
- //
1197
- // To fix this UB rustc would like to change in the future to catch unwinds
1198
- // from function calls that may unwind within a Rust-defined `extern "C"`
1199
- // function and forcibly abort the process, thereby respecting the
1200
- // `nounwind` attribute emitted for `extern "C"`. This behavior change isn't
1201
- // ready to roll out, so determining whether or not the `C` family of ABIs
1202
- // unwinds is conditional not only on their definition but also whether the
1203
- // `#![feature(c_unwind)]` feature gate is active.
1204
- //
1205
- // Note that this means that unlike historical compilers rustc now, by
1206
- // default, unconditionally thinks that the `C` ABI may unwind. This will
1207
- // prevent some optimization opportunities, however, so we try to scope this
1208
- // change and only assume that `C` unwinds with `panic=unwind` (as opposed
1209
- // to `panic=abort`).
1210
- //
1211
- // Eventually the check against `c_unwind` here will ideally get removed and
1212
- // this'll be a little cleaner as it'll be a straightforward check of the
1213
- // ABI.
1214
- //
1215
- // [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
1216
1185
use SpecAbi :: * ;
1217
1186
match abi {
1218
1187
C { unwind }
@@ -1224,10 +1193,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) ->
1224
1193
| Thiscall { unwind }
1225
1194
| Aapcs { unwind }
1226
1195
| Win64 { unwind }
1227
- | SysV64 { unwind } => {
1228
- unwind
1229
- || ( !tcx. features ( ) . c_unwind && tcx. sess . panic_strategy ( ) == PanicStrategy :: Unwind )
1230
- }
1196
+ | SysV64 { unwind } => unwind,
1231
1197
PtxKernel
1232
1198
| Msp430Interrupt
1233
1199
| X86Interrupt
0 commit comments