diff options
| author | bors <bors@rust-lang.org> | 2025-04-30 08:17:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-04-30 08:17:30 +0000 |
| commit | d2eadb7a94ef8c9deb5137695df33cd1fc5aee92 (patch) | |
| tree | 04512e985a99a3715b4a0829826be7139fdcee09 /tests/ui/pattern/usefulness/refutable-pattern-errors.rs | |
| parent | 427288b3ce2d574847fdb41cc3184c893750e09a (diff) | |
| parent | 20faf8532b5ddeb636ba3078344b0cad058c8f8a (diff) | |
| download | rust-d2eadb7a94ef8c9deb5137695df33cd1fc5aee92.tar.gz rust-d2eadb7a94ef8c9deb5137695df33cd1fc5aee92.zip | |
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 https://github.com/rust-lang/compiler-team/issues/862.
Previous attempt - #139427.
r? `@jieyouxu`
Diffstat (limited to 'tests/ui/pattern/usefulness/refutable-pattern-errors.rs')
| -rw-r--r-- | tests/ui/pattern/usefulness/refutable-pattern-errors.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs index 7603da1bb2c..de9fc24bbd0 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs +++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs @@ -1,9 +1,11 @@ +//@ dont-require-annotations: NOTE + fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) {} //~^ ERROR refutable pattern in function argument -//~| `(..=0_isize, _)` and `(2_isize.., _)` not covered +//~| NOTE `(..=0_isize, _)` and `(2_isize.., _)` not covered fn main() { let (1, (Some(1), 2..=3)) = (1, (None, 2)); //~^ ERROR refutable pattern in local binding - //~| `(i32::MIN..=0_i32, _)` and `(2_i32..=i32::MAX, _)` not covered + //~| NOTE `(i32::MIN..=0_i32, _)` and `(2_i32..=i32::MAX, _)` not covered } |
