about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorIvor Wanders <ivor@iwanders.net>2022-01-16 11:43:16 -0500
committerIvor Wanders <ivor@iwanders.net>2022-01-16 11:43:16 -0500
commit1531d26fa3896869818b40d6771d8b3cdaf2f6eb (patch)
tree737cce016a4268375ec9ab6d0daf4bc5b96655a1 /compiler/rustc_interface/src
parent32be3489a52271520e6bc6c6653ce7457292c48b (diff)
downloadrust-1531d26fa3896869818b40d6771d8b3cdaf2f6eb.tar.gz
rust-1531d26fa3896869818b40d6771d8b3cdaf2f6eb.zip
Limit scope of the hint about escaping.
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/interface.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs
index 8fa1e18df3c..26343561959 100644
--- a/compiler/rustc_interface/src/interface.rs
+++ b/compiler/rustc_interface/src/interface.rs
@@ -124,10 +124,16 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
                     Err(errs) => errs.into_iter().for_each(|mut err| err.cancel()),
                 }
 
-                error!(concat!(
-                    r#"expected `key` or `key="value"`, ensure escaping is appropriate"#,
-                    r#" for your shell, try 'key="value"' or key=\"value\""#
-                ));
+                // If the user tried to use a key="value" flag, but is missing the quotes, provide
+                // a hint about how to resolve this.
+                if s.contains("=") && !s.contains("=\"") && !s.ends_with("\"") {
+                    error!(concat!(
+                        r#"expected `key` or `key="value"`, ensure escaping is appropriate"#,
+                        r#" for your shell, try 'key="value"' or key=\"value\""#
+                    ));
+                } else {
+                    error!(r#"expected `key` or `key="value"`"#);
+                }
             })
             .collect::<CrateConfig>();
         cfg.into_iter().map(|(a, b)| (a.to_string(), b.map(|b| b.to_string()))).collect()