Skip to content

compiletest silently fails on a name-value directive with a known name but missing colon but does not report an error #123760

Open
@jieyouxu

Description

@jieyouxu

compiletest expects that a name-value directive, like //@ revisions: foo, to have the colon :

pub fn parse_name_value_directive(&self, line: &str, directive: &str) -> Option<String> {
let colon = directive.len();
if line.starts_with(directive) && line.as_bytes().get(colon) == Some(&b':') {
let value = line[(colon + 1)..].to_owned();
debug!("{}: {}", directive, value);
Some(expand_variables(value, self))
} else {
None
}
}

If the name-value directive contains a known directive name like revisions but does not have the colon (i.e. //@ revisions foo), then:

  • compiletest known directive check accepts the known directive name revisions
  • parse_name_value_directive expects revisions: but only got revisions, so parsing fails
  • no other compiletest directive parsing rules accept revisions directive name
  • no errors raised yet there is no effect (no revisions in this example).

compiletest should not silently fail here because it's very surprising and a pain to debug unless you know exactly what's wrong.

Metadata

Metadata

Assignees

Labels

A-compiletestArea: The compiletest test runnerA-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions