]> git.lizzy.rs Git - rust.git/commitdiff
Improve error message for cfg arguments.
authorIvor Wanders <ivor@iwanders.net>
Thu, 13 Jan 2022 00:04:16 +0000 (19:04 -0500)
committerIvor Wanders <ivor@iwanders.net>
Thu, 13 Jan 2022 00:04:16 +0000 (19:04 -0500)
This provides the user with a helpful error message in case a key="value"
message was specified but couldn't be parsed.

compiler/rustc_interface/src/interface.rs

index 3804e10030733309293866cc5383da930661a2d8..8fa1e18df3c35609e7cca3232962f1c17ff51d8a 100644 (file)
@@ -124,7 +124,10 @@ macro_rules! error {
                     Err(errs) => errs.into_iter().for_each(|mut err| err.cancel()),
                 }
 
-                error!(r#"expected `key` or `key="value"`"#);
+                error!(concat!(
+                    r#"expected `key` or `key="value"`, ensure escaping is appropriate"#,
+                    r#" for your shell, try 'key="value"' or key=\"value\""#
+                ));
             })
             .collect::<CrateConfig>();
         cfg.into_iter().map(|(a, b)| (a.to_string(), b.map(|b| b.to_string()))).collect()