Skip to content

compiletest: Enforce that directives are consistently used with or without a colon#156450

Open
Zalathar wants to merge 1 commit into
rust-lang:mainfrom
Zalathar:colon-or-not
Open

compiletest: Enforce that directives are consistently used with or without a colon#156450
Zalathar wants to merge 1 commit into
rust-lang:mainfrom
Zalathar:colon-or-not

Conversation

@Zalathar
Copy link
Copy Markdown
Member

With the notable exception of //@ pp-exact, all directives expect to either always be used with a colon, or always be used without a colon. For example:

  • //@ uses-colon: value
  • //@ no-colon or //@ no-colon (remark)

Currently we just silently discard directives that use the wrong syntax, which is not great.

This PR therefore makes parse_name_directive and parse_name_value_directive panic if the wrong syntax is encountered.

The parser for pp-exact has been adjusted to check for the colon before deciding which parse method to call.

r? jieyouxu

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 11, 2026

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 11, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 11, 2026

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

@rust-log-analyzer

This comment was marked as off-topic.

@jieyouxu jieyouxu closed this May 12, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2026
@jieyouxu jieyouxu reopened this May 12, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 13, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants