Skip to content

compiletest: Support optional error annotations #140586

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

Closed
wants to merge 1 commit into from

Conversation

petrochenkov
Copy link
Contributor

that are not required to annotate an actual error, which is sometimes useful for target-dependent errors.

The syntax is //~ ERROR? message.

This is sort of a low cost low benefit feature, that is useful in specific cases.
I think it's better to have it, but not having it would also be ok.
The specific syntax is also up to debate.

r? @jieyouxu

that are not required to annotate an actual error, which is sometimes useful for target-dependent errors.

The syntax is `//~ ERROR? message`.
@rustbot rustbot added 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. labels May 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 2, 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

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@jieyouxu
Copy link
Member

jieyouxu commented May 2, 2025

I'm hesitant to support optional error annotations in this fashion (as opposed to not requiring exhaustive error annotations with an explicit opt-in), for a few reasons:

  1. If these "optional" (or somehow condition-dependent) errors are not important for test intention, I think not requring exhaustive error annotations is the better choice. Making these kind of errors optional but still show up in error annotations to me seems like distractions from the "important" errors w.r.t. test intention.
  2. I'm slightly concerned about the potential for misuse of this feature. In that, it seems quite easy to accidentally let through errors that we shouldn't be emitting, or accidentally missing errors that we should be emitting, for the given conditions. There's also only a ?-character difference, so this seems easy to miss in reviews/authoring too.
  3. I think we should identify why these errors are "sometimes"-only. Then see for instance:
    • Can the test be modified in a way without loss of test intention, such that the "unimportant" error isn't target-dependent, or doesn't get emitted at all?
    • Should a test be gated w.r.t. some capability/target/target arch/target env, if it's not important to test intention?
    • Or, should we simply have the error be ignored under dont-require-error-annotations if it's not important re. test intention?

I'm playing around w/ point (3) in #140588. Let me get back to you after playing around with the example tests changed in this PR.

@petrochenkov
Copy link
Contributor Author

Okay, I agree it's easy to misuse and some of the cases should be fixed in the compiler (especially tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs) and others could maybe addressed by splitting into two tests.

We just need to not forget to remove the FIXMEs if that doesn't work out.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants