Skip to content

~? annotation type is special #2403

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
Open

~? annotation type is special #2403

wants to merge 1 commit into from

Conversation

tshepang
Copy link
Member

It does not do any line matching, so it should be separated from the other types

@@ -192,7 +192,7 @@ They have several forms, but generally are a comment with the diagnostic level
to write out the entire message, just make sure to include the important part of
the message to make it self-documenting.

The error annotation needs to match with the line of the diagnostic. There are
Most error annotations need to match with the line of the diagnostic. There are
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we need this change; ~? actually matches the line not having the following message.
Emphasizing "not" would be enough for me if it's unclear.

Copy link
Member Author

Choose a reason for hiding this comment

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

that does not sound right... ~? is about errors without line information, while this group is about annotations tied to lines in the source code

Copy link
Member

@jieyouxu jieyouxu May 22, 2025

Choose a reason for hiding this comment

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

Yeah, //~? is used to match diagnostics without line information in the main test file. Possible cases:

  • Simply no line info at all.
  • Line info beyond main test file (w/ annotations), e.g. from auxiliaries or sources that we have no control over.

src/tests/ui.md Outdated
Comment on lines 222 to 224
`~?` is used to match error levels and messages with errors not having line
information. These can be placed on any line in the test file, but are
conventionally placed at the end.
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: can you use the full form i.e. //~? ERROR to make it more immediately obvious?

Copy link
Member Author

Choose a reason for hiding this comment

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

ERROR is just one of the error kinds/levels though, in that there could also be WARN and NOTE, for example

Copy link
Member

@jieyouxu jieyouxu May 22, 2025

Choose a reason for hiding this comment

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

"//~? DIAGNOSTIC_KIND" :D

Copy link
Member Author

Choose a reason for hiding this comment

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

... I improved the paragraph further

@@ -192,7 +192,7 @@ They have several forms, but generally are a comment with the diagnostic level
to write out the entire message, just make sure to include the important part of
the message to make it self-documenting.

The error annotation needs to match with the line of the diagnostic. There are
Most error annotations need to match with the line of the diagnostic. There are
Copy link
Member

@jieyouxu jieyouxu May 22, 2025

Choose a reason for hiding this comment

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

Yeah, //~? is used to match diagnostics without line information in the main test file. Possible cases:

  • Simply no line info at all.
  • Line info beyond main test file (w/ annotations), e.g. from auxiliaries or sources that we have no control over.

@jieyouxu jieyouxu added S-waiting-on-author Status: this PR is waiting for additional action by the OP A-compiletest Area: src/tools/compiletest A-test-suite Area: rust-lang/rust test suites T-compiler Relevant to compiler team labels May 22, 2025
@jieyouxu jieyouxu self-assigned this May 22, 2025
It does not do any line matching, so it should be separated from the other types.
@tshepang tshepang force-pushed the tshepang-patch-1 branch from 07120eb to eeafdb1 Compare May 22, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: src/tools/compiletest A-test-suite Area: rust-lang/rust test suites S-waiting-on-author Status: this PR is waiting for additional action by the OP T-compiler Relevant to compiler team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants