1
Fork 0

Fix ICE report flags display.

This commit is contained in:
Eric Huss 2022-09-08 16:08:53 -07:00
parent 1120c5e01d
commit ed0f0377e2

View file

@ -1119,22 +1119,25 @@ fn extra_compiler_flags() -> Option<(Vec<String>, bool)> {
while let Some(arg) = args.next() { while let Some(arg) = args.next() {
if let Some(a) = ICE_REPORT_COMPILER_FLAGS.iter().find(|a| arg.starts_with(*a)) { if let Some(a) = ICE_REPORT_COMPILER_FLAGS.iter().find(|a| arg.starts_with(*a)) {
let content = if arg.len() == a.len() { let content = if arg.len() == a.len() {
// A space-separated option, like `-C incremental=foo` or `--crate-type rlib`
match args.next() { match args.next() {
Some(arg) => arg.to_string(), Some(arg) => arg.to_string(),
None => continue, None => continue,
} }
} else if arg.get(a.len()..a.len() + 1) == Some("=") { } else if arg.get(a.len()..a.len() + 1) == Some("=") {
// An equals option, like `--crate-type=rlib`
arg[a.len() + 1..].to_string() arg[a.len() + 1..].to_string()
} else { } else {
// A non-space option, like `-Cincremental=foo`
arg[a.len()..].to_string() 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; excluded_cargo_defaults = true;
} else { } else {
result.push(a.to_string()); result.push(a.to_string());
match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.iter().find(|s| content.starts_with(*s)) match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.iter().find(|s| option == **s) {
{ Some(s) => result.push(format!("{}=[REDACTED]", s)),
Some(s) => result.push(s.to_string()),
None => result.push(content), None => result.push(content),
} }
} }