Skip to content

compiletest: Make diagnostic kind mandatory on line annotations (take 2) #139720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Apr 12, 2025

Compiletest currently accepts line annotations without kind in UI tests.

    let a = b + c; //~ my message

Such annotations have two effects.

  • First, they match any compiler-produced diagnostic kind. This functionality is never used in practice, there are no target-dependent diagnostic kinds of something like that.
  • Second, they are not "viral". For example, any explicit //~ NOTE my msg in a test requires all other NOTE diagnostics in the same test to be annotated. Implicit //~ my msg will just match the note and won't require other annotations.

The second functionality has a replacement since recently - directive //@ dont-require-annotations: NOTE.

This PR removes support for //~ my message and makes the explicit diagnostic kind mandatory.
Unwanted additional annotations are suppressed using the dont-require-annotations directive.

Closes rust-lang/compiler-team#862.
Previous attempt - #139427.
r? @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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 12, 2025
@petrochenkov
Copy link
Contributor Author

MCP: rust-lang/compiler-team#862, waiting on compiler team.

@petrochenkov petrochenkov added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). I-compiler-nominated Nominated for discussion during a compiler team meeting. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2025
@petrochenkov
Copy link
Contributor Author

Most of the diff is due to updated .stderr files.
Technically I could add the //@ dont-require-annotations: NOTE directives to file ends to avoid this, but it really goes against the usual style.

@rustbot
Copy link
Collaborator

rustbot commented Apr 12, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const ui tets changes LGTM, except that the PR also removes some colons which caught me by surprise as it wasn't mentioned... but if we will unify the colon vs no-colon style soon anyway, it doesn't really matter.

@petrochenkov
Copy link
Contributor Author

petrochenkov commented Apr 13, 2025

the PR also removes some colons which caught me by surprise as it wasn't mentioned

This is accidental, this PR was converted from #139427 which had some colon changes, and I tried to revert all of them, but apparently missed some. If some more are found during review I'll revert them too.

@bors

This comment was marked as resolved.

@tshepang
Copy link
Member

would be nice if this also updated rustc-dev-guide

@petrochenkov
Copy link
Contributor Author

would be nice if this also updated rustc-dev-guide

I'll update, I was waiting for #139618 to land first.

@petrochenkov petrochenkov removed the I-compiler-nominated Nominated for discussion during a compiler team meeting. label Apr 17, 2025
@petrochenkov
Copy link
Contributor Author

10 days since rust-lang/compiler-team#862 (comment) have passed.
@rustbot author

@rustbot
Copy link
Collaborator

rustbot commented Apr 26, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 26, 2025
@petrochenkov petrochenkov removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Apr 26, 2025
@rustbot rustbot added the A-rustc-dev-guide Area: rustc-dev-guide label Apr 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 26, 2025

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @jieyouxu, @Kobzol

@petrochenkov
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 26, 2025
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-rustc-dev-guide Area: rustc-dev-guide 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compiletest: Make diagnostic kind mandatory on line annotations
7 participants