Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c5563b8

Browse files
authoredJul 8, 2023
Rollup merge of #113467 - nbdd0121:unwind, r=compiler-errors
Fix comment of `fn_can_unwind` Reopen of #113213
2 parents 9b878e3 + 39c3ef7 commit c5563b8

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed
 

‎compiler/rustc_middle/src/ty/layout.rs

+5-11
Original file line numberDiff line numberDiff line change
@@ -1110,12 +1110,11 @@ where
11101110
///
11111111
/// This takes two primary parameters:
11121112
///
1113-
/// * `codegen_fn_attr_flags` - these are flags calculated as part of the
1114-
/// codegen attrs for a defined function. For function pointers this set of
1115-
/// flags is the empty set. This is only applicable for Rust-defined
1116-
/// functions, and generally isn't needed except for small optimizations where
1117-
/// we try to say a function which otherwise might look like it could unwind
1118-
/// doesn't actually unwind (such as for intrinsics and such).
1113+
/// * `fn_def_id` - the `DefId` of the function. If this is provided then we can
1114+
/// determine more precisely if the function can unwind. If this is not provided
1115+
/// then we will only infer whether the function can unwind or not based on the
1116+
/// ABI of the function. For example, a function marked with `#[rustc_nounwind]`
1117+
/// is known to not unwind even if it's using Rust ABI.
11191118
///
11201119
/// * `abi` - this is the ABI that the function is defined with. This is the
11211120
/// primary factor for determining whether a function can unwind or not.
@@ -1147,11 +1146,6 @@ where
11471146
/// aborts the process.
11481147
/// * This affects whether functions have the LLVM `nounwind` attribute, which
11491148
/// affects various optimizations and codegen.
1150-
///
1151-
/// FIXME: this is actually buggy with respect to Rust functions. Rust functions
1152-
/// compiled with `-Cpanic=unwind` and referenced from another crate compiled
1153-
/// with `-Cpanic=abort` will look like they can't unwind when in fact they
1154-
/// might (from a foreign exception or similar).
11551149
#[inline]
11561150
#[tracing::instrument(level = "debug", skip(tcx))]
11571151
pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) -> bool {

0 commit comments

Comments
 (0)
Please sign in to comment.