Skip to content

Commit 3f6ffa1

Browse files
committed
update comments
1 parent 93ee180 commit 3f6ffa1

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

Diff for: compiler/rustc_target/src/target_features.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,19 @@ impl Stability {
108108
// per-function level, since we would then allow safe calls from functions with `+soft-float` to
109109
// functions without that feature!
110110
//
111-
// It is important for soundness that features allowed here do *not* change the function call ABI.
112-
// For example, disabling the `x87` feature on x86 changes how scalar floats are passed as
113-
// arguments, so enabling toggling that feature would be unsound. In fact, since `-Ctarget-feature`
114-
// will just allow unknown features (with a warning), we have to explicitly list features that change
115-
// the ABI as `Forbidden` to ensure using them causes an error. Note that this is only effective if
116-
// such features can never be toggled via `-Ctarget-cpu`! If that is ever a possibility, we will need
117-
// extra checks ensuring that the LLVM-computed target features for a CPU did not (un)set a
118-
// `Forbidden` feature. See https://github.com/rust-lang/rust/issues/116344 for some more context.
119-
// FIXME: add such "forbidden" features for non-x86 targets.
111+
// It is important for soundness to consider the interaction of targets features and the function
112+
// call ABI. For example, disabling the `x87` feature on x86 changes how scalar floats are passed as
113+
// arguments, so letting people toggle that feature would be unsound. To this end, the
114+
// `abi_required_features` function computes which target features must and must not be enabled for
115+
// any given target, and individual features can also be marked as `Forbidden`.
116+
// See https://github.com/rust-lang/rust/issues/116344 for some more context.
120117
//
121118
// The one exception to features that change the ABI is features that enable larger vector
122-
// registers. Those are permitted to be listed here. This is currently unsound (see
123-
// https://github.com/rust-lang/rust/issues/116558); in the future we will have to ensure that
124-
// functions can only use such vectors as arguments/return types if the corresponding target feature
125-
// is enabled.
119+
// registers. Those are permitted to be listed here. The `*_FOR_CORRECT_VECTOR_ABI` arrays store
120+
// information about which target feature is ABI-required for which vector size; this is used to
121+
// ensure that vectors can only be passed via `extern "C"` when the right feature is enabled. (For
122+
// the "Rust" ABI we generally pass vectors by-ref exactly to avoid these issues.)
123+
// Also see https://github.com/rust-lang/rust/issues/116558.
126124
//
127125
// Stabilizing a target feature requires t-lang approval.
128126

0 commit comments

Comments
 (0)