Skip to content

Commit 8b98c37

Browse files
committed
Auto merge of rust-lang#113213 - nbdd0121:unwind, r=<try>
Fix outdated comment of `fn_can_unwind` The first part is outdated since rust-lang#96473, and the second part is outdated since rust-lang#97235
2 parents 4dbc7e3 + 39c3ef7 commit 8b98c37

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

0 commit comments

Comments
 (0)