Merge pull request #2403 from rust-lang/tshepang-patch-1

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-05-23 19:42:58 +08:00 committed by GitHub
commit 8392ed6950
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -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 to write out the entire message, just make sure to include the important part of
the message to make it self-documenting. 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
several ways to match the message with the line (see the examples below): several ways to match the message with the line (see the examples below):
* `~`: Associates the error level and message with the *current* line * `~`: Associates the error level and message with the *current* line
@ -205,9 +205,6 @@ several ways to match the message with the line (see the examples below):
* `~v`: Associates the error level and message with the *next* error * `~v`: Associates the error level and message with the *next* error
annotation line. Each symbol (`v`) that you add adds a line to this, so `~vvv` annotation line. Each symbol (`v`) that you add adds a line to this, so `~vvv`
is three lines below the error annotation line. is three lines below the error annotation line.
* `~?`: 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.
Example: Example:
@ -222,6 +219,10 @@ The space character between `//~` (or other variants) and the subsequent text is
negligible (i.e. there is no semantic difference between `//~ ERROR` and negligible (i.e. there is no semantic difference between `//~ ERROR` and
`//~ERROR` although the former is more common in the codebase). `//~ERROR` although the former is more common in the codebase).
`~? <diagnostic kind>` (example being `~? ERROR`)
is used to match diagnostics without line information.
These can be placed on any line in the test file, but are conventionally placed at the end.
### Error annotation examples ### Error annotation examples
Here are examples of error annotations on different lines of UI test source. Here are examples of error annotations on different lines of UI test source.