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