rust-lang / rust-lang/rust

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

Open
#123,760 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-compiletest A-testsuite C-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

https://github.com/rust-lang/rust/blob/b14d8b2ef20c64c1002e2c6c724025c3d0846b91/src/tools/compiletest/src/header.rs#L1137-L1146

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The relevant code is in src/tools/compiletest/src/header.rs around the linked lines, with parsing handled by parse_name_value_directive. Start there and trace how a known directive name without ':' is handled; done means the malformed directive reports an error instead of being silently ignored, with regression coverage in the relevant compiletest tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.