File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,9 @@ several ways to match the message with the line (see the examples below):
202202* ` ~| ` : Associates the error level and message with the * same* line as the
203203 * previous comment* . This is more convenient than using multiple carets when
204204 there are multiple messages associated with the same line.
205+ * ` ~v ` : Associates the error level and message with the * next* error
206+ annotation line. Each symbol (` v ` ) that you add adds a line to this, so ` ~vvv `
207+ is three lines below the error annotation line.
205208* ` ~? ` : Used to match error levels and messages with errors not having line
206209 information. These can be placed on any line in the test file, but are
207210 conventionally placed at the end.
@@ -273,6 +276,18 @@ fn main() {
273276//~| ERROR this pattern has 1 field, but the corresponding tuple struct has 3 fields [E0023]
274277```
275278
279+ #### Positioned above error line
280+
281+ Use the ` //~v ` idiom with number of v's in the string to indicate the number
282+ of lines below. This is typically used in lexer or parser tests matching on errors like unclosed
283+ delimiter or unclosed literal happening at the end of file.
284+
285+ ``` rust,ignore
286+ // ignore-tidy-trailing-newlines
287+ //~v ERROR this file contains an unclosed delimiter
288+ fn main((ؼ
289+ ```
290+
276291#### Error without line information
277292
278293Use ` //~? ` to match an error without line information.
You can’t perform that action at this time.
0 commit comments