about summary refs log tree commit diff
path: root/compiler/rustc_driver/src/lib.rs
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2022-09-08 16:08:53 -0700
committerEric Huss <eric@huss.org>2022-09-08 16:08:53 -0700
commited0f0377e2620ed3c70a42890ca420c1472eb788 (patch)
tree06f77b80b5855a849f185ac541314589b17ea019 /compiler/rustc_driver/src/lib.rs
parent1120c5e01df508de64fe6642f22fadeb574afd6d (diff)
downloadrust-ed0f0377e2620ed3c70a42890ca420c1472eb788.tar.gz
rust-ed0f0377e2620ed3c70a42890ca420c1472eb788.zip
Fix ICE report flags display.
Diffstat (limited to 'compiler/rustc_driver/src/lib.rs')
-rw-r--r--compiler/rustc_driver/src/lib.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index a193d5db691..d6f51d7eee1 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -1119,22 +1119,25 @@ fn extra_compiler_flags() -> Option<(Vec<String>, bool)> {
     while let Some(arg) = args.next() {
         if let Some(a) = ICE_REPORT_COMPILER_FLAGS.iter().find(|a| arg.starts_with(*a)) {
             let content = if arg.len() == a.len() {
+                // A space-separated option, like `-C incremental=foo` or `--crate-type rlib`
                 match args.next() {
                     Some(arg) => arg.to_string(),
                     None => continue,
                 }
             } else if arg.get(a.len()..a.len() + 1) == Some("=") {
+                // An equals option, like `--crate-type=rlib`
                 arg[a.len() + 1..].to_string()
             } else {
+                // A non-space option, like `-Cincremental=foo`
                 arg[a.len()..].to_string()
             };
-            if ICE_REPORT_COMPILER_FLAGS_EXCLUDE.iter().any(|exc| content.starts_with(exc)) {
+            let option = content.split_once('=').map(|s| s.0).unwrap_or(&content);
+            if ICE_REPORT_COMPILER_FLAGS_EXCLUDE.iter().any(|exc| option == *exc) {
                 excluded_cargo_defaults = true;
             } else {
                 result.push(a.to_string());
-                match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.iter().find(|s| content.starts_with(*s))
-                {
-                    Some(s) => result.push(s.to_string()),
+                match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.iter().find(|s| option == **s) {
+                    Some(s) => result.push(format!("{}=[REDACTED]", s)),
                     None => result.push(content),
                 }
             }