-
Notifications
You must be signed in to change notification settings - Fork 13.3k
compiletest: Make diagnostic kind mandatory on line annotations #139427
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
Conversation
Some changes occurred in src/tools/compiletest cc @jieyouxu These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
Currently, compiletest has the useful feature where I can match on some NOTE-level annotations without matching on all of them by writing So if the diagnostic kind/level is required, how do I write a test like that? FWIW, tree-wide changes like this and #139448 require an MCP in my eyes. |
@RalfJung That's the main unresolved issue, see the PR description and the discussion of |
So, I implemented this alternative in the second commit f22f55d and it kind of works. Without it UI tests suite requires adding 1624 missing NOTE annotations, and with it - 978. |
Yeah, I think this deserves an MCP, mostly to figure out the ergonomics/design of this from the POV of compiler contributors who write a lot of tests. At the moment, likewise, I'm kinda dilly-dallying between the options. I.e. there's 2 potentially competing use cases that we need to account for:
One possible alternative solution (yet another option) I can think of is sth like
Where,
At the cost of even more directives of course. |
ui_test has a separate directive,
That seems oddly inconsistent, and may accidentally weaken some existing tests.
It's hard for me to predict the impact on that, but I think the const tests probably have notes in the same top-level diagnostic that we don't want to have to list in the test file. Also, this too could accidentally weaken existing tests. |
After considering the alternatives, I think we should adopt something equivalent to We cannot adopt it exactly, because in compiletest diagnostic kinds are not ordered, and do not use the "if a level is specified explicitly, all diagnostics of that level or higher need an annotation" scheme for requiring annotations. This would be useful not just for Why not the alternatives:
|
They are not? How does it work instead? ui_test is modeled after how we thought compiletest works.^^ |
|
Interesting. @oli-obk maybe ui_test should match that to avoid unnecessary confusion. (Probably best to await the outcome of this discussion and then considering syncing with whatever compiletest ends up doing.) |
Yea well match whatever comes out of that |
Some non-controversial parts are extracted into #139485. |
Implemented in #139489. |
☔ The latest upstream changes (presumably #139482) made this pull request unmergeable. Please resolve the merge conflicts. |
…obk,jieyouxu compiletest: Stricter parsing for diagnostic kinds Non-controversial parts of rust-lang#139427 not requiring many changes in the test suite. r? `@jieyouxu`
…obk,jieyouxu compiletest: Stricter parsing for diagnostic kinds Non-controversial parts of rust-lang#139427 not requiring many changes in the test suite. r? ``@jieyouxu``
UI tests: add missing diagnostic kinds where possible The subset of rust-lang#139427 that only adds diagnostic kinds to line annotations, without changing any other things in annotations or compiletest. After this only non-viral `NOTE`s and `HELP`s should be missing. r? `@jieyouxu`
Rollup merge of rust-lang#139485 - petrochenkov:errkind-light, r=oli-obk,jieyouxu compiletest: Stricter parsing for diagnostic kinds Non-controversial parts of rust-lang#139427 not requiring many changes in the test suite. r? ``@jieyouxu``
compiletest: Add directive `dont-require-annotations` for making matching on specific diagnostic kinds non-exhaustive. E.g. `//@ dont-require-annotations:ERROR`, like in the examples in this PR. cc rust-lang#139427 (comment) Closes rust-lang#132647 FYI `@BoxyUwU` since you've wanted this. r? `@jieyouxu`
Rollup merge of rust-lang#139489 - petrochenkov:noreqann, r=jieyouxu compiletest: Add directive `dont-require-annotations` for making matching on specific diagnostic kinds non-exhaustive. E.g. `//@ dont-require-annotations:ERROR`, like in the examples in this PR. cc rust-lang#139427 (comment) Closes rust-lang#132647 FYI `@BoxyUwU` since you've wanted this. r? `@jieyouxu`
compiletest: Add directive `dont-require-annotations` for making matching on specific diagnostic kinds non-exhaustive. E.g. `//@ dont-require-annotations:ERROR`, like in the examples in this PR. cc rust-lang/rust#139427 (comment) Closes #132647 FYI `@BoxyUwU` since you've wanted this. r? `@jieyouxu`
The job Click to see the possible cause of the failure (guessed by this bot)
|
Closing in favor of #139720. |
Most of annotations have them, this PR adds all the missing ones.
Also, parsing of diagnostic kinds is made stricter to not accept things like
Error
orerror:
.One major issue in doing this is that
NOTE
andHELP
annotations are viral.If you add one such annotation to a file, then you must annotate all the other
NOTE
s andHELP
s annotations in that file.Empty kind was often used as an opt out from that rule - we use an empty kind instead of
NOTE
and voila, otherNOTE
s no longer need to be annotated.For now, I've introduced
NOTE_NONVIRAL
andHELP_NONVIRAL
annotations to reproduce the old behavior while still specifying the kind, but I wonder, what would be the best solution here longer term.NOTE
s andHELP
s and deal with it? (Not in this PR, there are many of them.)NONVIRAL
flavors.For statistics, there are currently 3696
NOTE
s and 648NOTE_NONVIRAL
s in the UI test suite.Also 1824
HELP
s and 12HELP_NONVIRAL
s (thus forHELP
specifically the "add remaining annotations" solution looks quite reasonable).r? @jieyouxu