File tree 1 file changed +23
-0
lines changed
compiler/rustc_target/src/spec
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 34
34
//! the target's settings, though `target-feature` and `link-args` will *add*
35
35
//! to the list specified by the target, rather than replace.
36
36
37
+ // ignore-tidy-filelength
38
+
37
39
use std:: assert_matches:: assert_matches;
38
40
use std:: borrow:: Cow ;
39
41
use std:: collections:: BTreeMap ;
@@ -2593,6 +2595,18 @@ impl TargetOptions {
2593
2595
. collect ( ) ;
2594
2596
}
2595
2597
}
2598
+
2599
+ pub ( crate ) fn has_neg_feature ( & self , search_feature : & str ) -> bool {
2600
+ self . features . split ( ',' ) . any ( |f| {
2601
+ if let Some ( f) = f. strip_prefix ( '-' )
2602
+ && f == search_feature
2603
+ {
2604
+ true
2605
+ } else {
2606
+ false
2607
+ }
2608
+ } )
2609
+ }
2596
2610
}
2597
2611
2598
2612
impl Default for TargetOptions {
@@ -3108,6 +3122,15 @@ impl Target {
3108
3122
_ => { }
3109
3123
}
3110
3124
3125
+ // Check that aarch64 hardfloat targets do not disable neon or fp-armv8 (which are
3126
+ // on-by-default).
3127
+ if self . arch == "aarch64" && self . abi != "softfloat" {
3128
+ check ! (
3129
+ !self . has_neg_feature( "neon" ) && !self . has_neg_feature( "fp-armv8" ) ,
3130
+ "aarch64 hardfloat targets must not disable the `neon` or `fp-armv8` target features"
3131
+ ) ;
3132
+ }
3133
+
3111
3134
Ok ( ( ) )
3112
3135
}
3113
3136
You can’t perform that action at this time.
0 commit comments