From 74e2ac406ba620aeff8732d2dde96c0839dcacbf Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 15 Dec 2024 11:20:00 +0100 Subject: [PATCH] advice against negative features in target specs Co-authored-by: Jubilee --- compiler/rustc_target/src/spec/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index f7cf12215f3b..a44d2af6b908 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2213,6 +2213,10 @@ pub struct TargetOptions { /// `-Ctarget-cpu` but can be overwritten with `-Ctarget-features`. /// Corresponds to `llc -mattr=$features`. /// Note that these are LLVM feature names, not Rust feature names! + /// + /// Generally it is a bad idea to use negative target features because they often interact very + /// poorly with how `-Ctarget-cpu` works. Instead, try to use a lower "base CPU" and enable the + /// features you want to use. pub features: StaticCow, /// Direct or use GOT indirect to reference external data symbols pub direct_access_external_data: Option,