From 8e480e5d42af615c6b56490b9569d82391d2ae94 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 4 Nov 2025 14:57:57 +0100 Subject: [PATCH] docs(README): document `//~^`, `//~v`, `//~|` --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 3a013192..a6748a0d 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,27 @@ of the error. These comments can take two forms: * `CODE` can take multiple forms such as: `E####`, `lint_name`, `tool::lint_name`. * This will only match a diagnostic at the `ERROR` level. +The annotation can be put on a different line from the error location using `v`/`^`: +```rs +causes_some_error() +//~^ some_error + +//~v some_error +causes_some_error() +``` +By repeating those symbols `n` times, one can annotate an error located `n` lines away: +```rs +causes_some_error() + +//~^^ some_error +``` +If there are multiple errors on the same line, annotations can be put on consecutive lines, and "chained" with `|`: +```rs +causes_some_error_and_other_error() +//~^ some_error +//~| other_error +``` + In order to change how a single test is tested, you can add various `//@` comments to the test. Any other comments will be ignored, and all `//@` comments must be formatted precisely as their command specifies, or the test will fail without even being run.