Skip to content

Commit 8094e84

Browse files
advice against negative features in target specs
Co-authored-by: Jubilee <[email protected]>
1 parent 0c9d42c commit 8094e84

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+3
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,9 @@ impl TargetOptions {
26082608
self.features.split(',').any(|f| f.strip_prefix('+').is_some_and(|f| f == search_feature))
26092609
}
26102610

2611+
/// We should try to minimize the number of negative features defined for any target
2612+
/// because they often interact very poorly with how `-Ctarget-cpu` works.
2613+
/// However, their mere existence is still a possibility, so!
26112614
pub(crate) fn has_neg_feature(&self, search_feature: &str) -> bool {
26122615
self.features.split(',').any(|f| f.strip_prefix('-').is_some_and(|f| f == search_feature))
26132616
}

0 commit comments

Comments
 (0)