File tree 1 file changed +7
-0
lines changed
compiler/rustc_target/src/spec
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2213,6 +2213,10 @@ pub struct TargetOptions {
2213
2213
/// `-Ctarget-cpu` but can be overwritten with `-Ctarget-features`.
2214
2214
/// Corresponds to `llc -mattr=$features`.
2215
2215
/// Note that these are LLVM feature names, not Rust feature names!
2216
+ ///
2217
+ /// Generally it is a bad idea to use negative features here since they
2218
+ /// interact poorly with `-Ctarget-cpu`. Instead, try to use a lower
2219
+ /// "base CPU" and enable the features you want to use.
2216
2220
pub features : StaticCow < str > ,
2217
2221
/// Direct or use GOT indirect to reference external data symbols
2218
2222
pub direct_access_external_data : Option < bool > ,
@@ -2608,6 +2612,9 @@ impl TargetOptions {
2608
2612
self . features . split ( ',' ) . any ( |f| f. strip_prefix ( '+' ) . is_some_and ( |f| f == search_feature) )
2609
2613
}
2610
2614
2615
+ /// We should try to minimize the number of negative features defined for any target
2616
+ /// because they often interact very poorly with how `-Ctarget-cpu` works.
2617
+ /// However, their mere existence is still a possibility, so!
2611
2618
pub ( crate ) fn has_neg_feature ( & self , search_feature : & str ) -> bool {
2612
2619
self . features . split ( ',' ) . any ( |f| f. strip_prefix ( '-' ) . is_some_and ( |f| f == search_feature) )
2613
2620
}
You can’t perform that action at this time.
0 commit comments