File tree 1 file changed +21
-0
lines changed
compiler/rustc_target/src/spec
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2593,6 +2593,18 @@ impl TargetOptions {
2593
2593
. collect ( ) ;
2594
2594
}
2595
2595
}
2596
+
2597
+ pub ( crate ) fn has_neg_feature ( & self , search_feature : & str ) -> bool {
2598
+ self . features . split ( ',' ) . any ( |f| {
2599
+ if let Some ( f) = f. strip_prefix ( '-' )
2600
+ && f == search_feature
2601
+ {
2602
+ true
2603
+ } else {
2604
+ false
2605
+ }
2606
+ } )
2607
+ }
2596
2608
}
2597
2609
2598
2610
impl Default for TargetOptions {
@@ -3108,6 +3120,15 @@ impl Target {
3108
3120
_ => { }
3109
3121
}
3110
3122
3123
+ // Check that aarch64 hardfloat targets do not disable neon or fp-armv8 (which are
3124
+ // on-by-default).
3125
+ if self . arch == "aarch64" && self . abi != "softfloat" {
3126
+ check ! (
3127
+ !self . has_neg_feature( "neon" ) && !self . has_neg_feature( "fp-armv8" ) ,
3128
+ "aarch64 hardfloat targets must not disable the `neon` or `fp-armv8` target features"
3129
+ ) ;
3130
+ }
3131
+
3111
3132
Ok ( ( ) )
3112
3133
}
3113
3134
You can’t perform that action at this time.
0 commit comments