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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions