Skip to content

Commit 658763b

Browse files
committed
Fix review comments
1 parent f44fbb3 commit 658763b

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

compiler/rustc_codegen_ssa/src/target_features.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub(crate) fn check_target_feature_trait_unsafe(tcx: TyCtxt<'_>, id: LocalDefId,
142142
/// Parse the value of the target spec `features` field or `-Ctarget-feature`, also expanding
143143
/// implied features, and call the closure for each (expanded) Rust feature. If the list contains
144144
/// a syntactically invalid item (not starting with `+`/`-`), the error callback is invoked.
145-
fn parse_rust_feature_flag<'a>(
145+
fn parse_rust_feature_list<'a>(
146146
sess: &'a Session,
147147
features: &'a str,
148148
err_callback: impl Fn(&'a str),
@@ -245,7 +245,7 @@ pub fn cfg_target_feature<'a, const N: usize>(
245245
let mut enabled_disabled_features = FxHashMap::default();
246246

247247
// Add enabled and remove disabled features.
248-
parse_rust_feature_flag(
248+
parse_rust_feature_list(
249249
sess,
250250
&sess.opts.cg.target_feature,
251251
/* err_callback */
@@ -378,7 +378,7 @@ pub fn target_spec_to_backend_features<'a>(
378378
) {
379379
// Compute implied features
380380
let mut rust_features = vec![];
381-
parse_rust_feature_flag(
381+
parse_rust_feature_list(
382382
sess,
383383
&sess.target.features,
384384
/* err_callback */
@@ -409,7 +409,7 @@ pub fn flag_to_backend_features<'a>(
409409
) {
410410
// Compute implied features
411411
let mut rust_features = vec![];
412-
parse_rust_feature_flag(
412+
parse_rust_feature_list(
413413
sess,
414414
&sess.opts.cg.target_feature,
415415
/* err_callback */

compiler/rustc_interface/src/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ impl CodegenBackend for DummyCodegenBackend {
364364
}
365365

366366
fn target_config(&self, sess: &Session) -> TargetConfig {
367+
let abi_required_features = sess.target.abi_required_features();
367368
let (target_features, unstable_target_features) = cfg_target_feature::<0>(
368369
sess,
369370
|_feature| Default::default(),
@@ -372,7 +373,7 @@ impl CodegenBackend for DummyCodegenBackend {
372373
// It would be better to parse target.features instead and handle implied features,
373374
// but target.features doesn't contain features that are enabled by default for an
374375
// architecture or target cpu.
375-
sess.target.abi_required_features().required.contains(&feature)
376+
abi_required_features.required.contains(&feature)
376377
},
377378
);
378379

compiler/rustc_target/src/spec/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,10 +2246,10 @@ pub struct TargetOptions {
22462246
/// Whether a cpu needs to be explicitly set.
22472247
/// Set to true if there is no default cpu. Defaults to false.
22482248
pub need_explicit_cpu: bool,
2249-
/// Default target features to pass to LLVM. These features overwrite
2250-
/// `-Ctarget-cpu` but can be overwritten with `-Ctarget-features`.
2251-
/// Corresponds to `llc -mattr=$llvm_features` where `$llvm_features` is the result of mapping
2252-
/// the Rust features in this field to LLVM features.
2249+
/// Default (Rust) target features to enable for this target. These features
2250+
/// overwrite `-Ctarget-cpu` but can be overwritten with `-Ctarget-features`.
2251+
/// Corresponds to `llc -mattr=$llvm_features` where `$llvm_features` is the
2252+
/// result of mapping the Rust features in this field to LLVM features.
22532253
///
22542254
/// Generally it is a bad idea to use negative target features because they often interact very
22552255
/// poorly with how `-Ctarget-cpu` works. Instead, try to use a lower "base CPU" and enable the

0 commit comments

Comments
 (0)