Skip to content

Commit 39c3ef7

Browse files
committed
Fix comment of fn_can_unwind
1 parent 56d507d commit 39c3ef7

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
@@ -1101,12 +1101,11 @@ where
11011101
///
11021102
/// This takes two primary parameters:
11031103
///
1104-
/// * `codegen_fn_attr_flags` - these are flags calculated as part of the
1105-
/// codegen attrs for a defined function. For function pointers this set of
1106-
/// flags is the empty set. This is only applicable for Rust-defined
1107-
/// functions, and generally isn't needed except for small optimizations where
1108-
/// we try to say a function which otherwise might look like it could unwind
1109-
/// doesn't actually unwind (such as for intrinsics and such).
1104+
/// * `fn_def_id` - the `DefId` of the function. If this is provided then we can
1105+
/// determine more precisely if the function can unwind. If this is not provided
1106+
/// then we will only infer whether the function can unwind or not based on the
1107+
/// ABI of the function. For example, a function marked with `#[rustc_nounwind]`
1108+
/// is known to not unwind even if it's using Rust ABI.
11101109
///
11111110
/// * `abi` - this is the ABI that the function is defined with. This is the
11121111
/// primary factor for determining whether a function can unwind or not.
@@ -1138,11 +1137,6 @@ where
11381137
/// aborts the process.
11391138
/// * This affects whether functions have the LLVM `nounwind` attribute, which
11401139
/// affects various optimizations and codegen.
1141-
///
1142-
/// FIXME: this is actually buggy with respect to Rust functions. Rust functions
1143-
/// compiled with `-Cpanic=unwind` and referenced from another crate compiled
1144-
/// with `-Cpanic=abort` will look like they can't unwind when in fact they
1145-
/// might (from a foreign exception or similar).
11461140
#[inline]
11471141
#[tracing::instrument(level = "debug", skip(tcx))]
11481142
pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) -> bool {

0 commit comments

Comments
 (0)