I think you meant to use #[cfg(target_feature = "neon")]?.
the #[target_feature(...)] attribute is a (per-function) codegen option for the backend, it's related, but not the equivalent to conditional compilcation guards.
i was hoping to do both, the #[targhet_feature(..)] to be able to use neon stuff in my function and the conditional compilation to stop it from coloring the functions that use it
it doesn't make much sense to use both on the same function.
if you want to select different implementations at compile time, use #[cfg(target_feature = "neon")] and #[cfg(not(target_feature = "neon"))] (or use the x cfg-if crate). in this case, the #[target_feature(...)] attribute is redundent anyway.
if you want to select the function at runtime, you can use #[target_feature(...)], but you'll have to use runtime feature detection (such as std::is_x86_feature_detected!(...)), conditional compilation (such as the #[cfg(target_feature = ...)] attribute or the cfg!(target_feature = ...) macro) is useless in this case.
if you want to conditionally enable special target features only for targets without it, something like this:
think again: it's equivalent to just use #[target_feature(enable = "neon")]!
if you use #[target_feature()], the coloring problem is inevitable, but you can control the scope of it. passing a -C target_feature compiler flag controls the global "color", while a (runtime-checked) conditional unsafe block limits the target feature locally.
using conditional compilation can select different functions (with different "colors") to call at compile time, but then you don't need #[target_feature()] in such cases, you set the global "color" for the entire compilation unit instead.
the target feature attribute is additive only, you cannot disable a feature for a selected function (we don't have #[target_feature(disable = ...)]), disabling a target feature can only be done globally as -C target_feature=-feature_name compiler flag.