Skip to content

Commit 51762a9

Browse files
committed
Auto merge of #139720 - petrochenkov:errkind2, r=jieyouxu
compiletest: Make diagnostic kind mandatory on line annotations (take 2) Compiletest currently accepts line annotations without kind in UI tests. ``` let a = b + c; //~ my message ``` Such annotations have two effects. - First, they match any compiler-produced diagnostic kind. This functionality is never used in practice, there are no target-dependent diagnostic kinds of something like that. - Second, they are not "viral". For example, any explicit `//~ NOTE my msg` in a test requires all other `NOTE` diagnostics in the same test to be annotated. Implicit `//~ my msg` will just match the note and won't require other annotations. The second functionality has a replacement since recently - directive `//@ dont-require-annotations: NOTE`. This PR removes support for `//~ my message` and makes the explicit diagnostic kind mandatory. Unwanted additional annotations are suppressed using the `dont-require-annotations` directive. Closes rust-lang/compiler-team#862. Previous attempt - #139427. r? `@jieyouxu`
2 parents f24f31a + d41f1f4 commit 51762a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tests/ui.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ E.g. use `//@ dont-require-annotations: NOTE` to annotate notes selectively.
372372
Avoid using this directive for `ERROR`s and `WARN`ings, unless there's a serious reason, like
373373
target-dependent compiler output.
374374

375-
Missing diagnostic kinds (`//~ message`) are currently accepted, but are being phased away.
376-
They will match any compiler output kind, but will not force exhaustive annotations for that kind.
377-
Prefer explicit kind and `//@ dont-require-annotations` to achieve the same effect.
375+
Some diagnostics are never required to be line-annotated, regardless of their kind or directives,
376+
for example secondary lines of multiline diagnostics,
377+
or ubiquitous diagnostics like `aborting due to N previous errors`.
378378

379379
UI tests use the `-A unused` flag by default to ignore all unused warnings, as
380380
unused warnings are usually not the focus of a test. However, simple code

0 commit comments

Comments
 (0)