rust-lang / rust-lang/rust

compiletest: warn if we see a `// @<directive-name>`

Open
#125,813 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Realized in https://github.com/rust-lang/rust/pull/125808#discussion_r1622294753.

A test writer might accidentally write

// @ignore-cross-compile

which is parsed as a normal comment not a compiletest directive because compiletest directives require that the line starts with //@.

This typo is hard to spot: both by PR authors and the reviewers. It might not fail in PR CI -- it might not even fail in full build CI, but then explode when the conditions are just right.

We should detect these and issue at least warnings from compiletest to help test writers realize the problem.

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

Start by locating compiletest's directive parser and how it reports diagnostics. Add coverage for lines using // @<directive-name> and verify that compiletest warns for the typo while valid //@ directives continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.