@@ -280,6 +280,7 @@ const AARCH64_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
280280 ( "flagm" , STABLE , & [ ] ) ,
281281 // FEAT_FLAGM2
282282 ( "flagm2" , unstable ( sym:: aarch64_unstable_target_feature) , & [ ] ) ,
283+ ( "fp-armv8" , Stability :: Forbidden { reason : "Rust ties `fp-armv8` to `neon`" } , & [ ] ) ,
283284 // FEAT_FP16
284285 // Rust ties FP and Neon: https://github.com/rust-lang/rust/pull/91608
285286 ( "fp16" , STABLE , & [ "neon" ] ) ,
@@ -315,7 +316,28 @@ const AARCH64_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
315316 // FEAT_MTE & FEAT_MTE2
316317 ( "mte" , STABLE , & [ ] ) ,
317318 // FEAT_AdvSimd & FEAT_FP
318- ( "neon" , STABLE , & [ ] ) ,
319+ (
320+ "neon" ,
321+ Stability :: Stable {
322+ allow_toggle : |target, enable| {
323+ if target. abi == "softfloat" {
324+ // `neon` has no ABI implications for softfloat targets, we can allow this.
325+ Ok ( ( ) )
326+ } else if enable
327+ && !target. has_neg_feature ( "fp-armv8" )
328+ && !target. has_neg_feature ( "neon" )
329+ {
330+ // neon is enabled by default, and has not been disabled, so enabling it again
331+ // is redundant and we can permit it. Forbidding this would be a breaking change
332+ // since this feature is stable.
333+ Ok ( ( ) )
334+ } else {
335+ Err ( "unsound on hard-float targets because it changes float ABI" )
336+ }
337+ } ,
338+ } ,
339+ & [ ] ,
340+ ) ,
319341 // FEAT_PAUTH (address authentication)
320342 ( "paca" , STABLE , & [ ] ) ,
321343 // FEAT_PAUTH (generic authentication)
0 commit comments