Skip to content

Commit 5cd8fb3

Browse files
authored
Merge pull request #345 from ada4a/doc-parse-pattern
docs(README): document `//~^`, `//~v`, `//~|`
2 parents 66275ef + 8e480e5 commit 5cd8fb3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ of the error. These comments can take two forms:
4141
* `CODE` can take multiple forms such as: `E####`, `lint_name`, `tool::lint_name`.
4242
* This will only match a diagnostic at the `ERROR` level.
4343

44+
The annotation can be put on a different line from the error location using `v`/`^`:
45+
```rs
46+
causes_some_error()
47+
//~^ some_error
48+
49+
//~v some_error
50+
causes_some_error()
51+
```
52+
By repeating those symbols `n` times, one can annotate an error located `n` lines away:
53+
```rs
54+
causes_some_error()
55+
56+
//~^^ some_error
57+
```
58+
If there are multiple errors on the same line, annotations can be put on consecutive lines, and "chained" with `|`:
59+
```rs
60+
causes_some_error_and_other_error()
61+
//~^ some_error
62+
//~| other_error
63+
```
64+
4465
In order to change how a single test is tested, you can add various `//@` comments to the test.
4566
Any other comments will be ignored, and all `//@` comments must be formatted precisely as
4667
their command specifies, or the test will fail without even being run.

0 commit comments

Comments
 (0)