diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 71e1072ceb3..b0b66e23201 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -697,6 +697,12 @@ impl Config { let (name, comment) = line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); + // Some of the matchers might be "" depending on what the target information is. To avoid + // problems we outright reject empty directives. + if name == "" { + return ParsedNameDirective::invalid(); + } + let mut outcome = MatchOutcome::Invalid; let mut message = None;