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/array-slice-vec | |
| 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/array-slice-vec')
| -rw-r--r-- | tests/ui/array-slice-vec/array-not-vector.rs | 10 | ||||
| -rw-r--r-- | tests/ui/array-slice-vec/array-not-vector.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/array-slice-vec/slice-mut.rs | 7 |
3 files changed, 12 insertions, 9 deletions
diff --git a/tests/ui/array-slice-vec/array-not-vector.rs b/tests/ui/array-slice-vec/array-not-vector.rs index d8b5b10d591..7345f721918 100644 --- a/tests/ui/array-slice-vec/array-not-vector.rs +++ b/tests/ui/array-slice-vec/array-not-vector.rs @@ -1,12 +1,14 @@ +//@ dont-require-annotations: NOTE + fn main() { let _x: i32 = [1, 2, 3]; //~^ ERROR mismatched types - //~| expected `i32`, found `[{integer}; 3]` + //~| NOTE expected `i32`, found `[{integer}; 3]` let x: &[i32] = &[1, 2, 3]; let _y: &i32 = x; //~^ ERROR mismatched types - //~| expected reference `&i32` - //~| found reference `&[i32]` - //~| expected `&i32`, found `&[i32]` + //~| NOTE expected reference `&i32` + //~| NOTE found reference `&[i32]` + //~| NOTE expected `&i32`, found `&[i32]` } diff --git a/tests/ui/array-slice-vec/array-not-vector.stderr b/tests/ui/array-slice-vec/array-not-vector.stderr index f20d99524dc..686c5dfe787 100644 --- a/tests/ui/array-slice-vec/array-not-vector.stderr +++ b/tests/ui/array-slice-vec/array-not-vector.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/array-not-vector.rs:2:19 + --> $DIR/array-not-vector.rs:4:19 | LL | let _x: i32 = [1, 2, 3]; | --- ^^^^^^^^^ expected `i32`, found `[{integer}; 3]` @@ -7,7 +7,7 @@ LL | let _x: i32 = [1, 2, 3]; | expected due to this error[E0308]: mismatched types - --> $DIR/array-not-vector.rs:7:20 + --> $DIR/array-not-vector.rs:9:20 | LL | let _y: &i32 = x; | ---- ^ expected `&i32`, found `&[i32]` diff --git a/tests/ui/array-slice-vec/slice-mut.rs b/tests/ui/array-slice-vec/slice-mut.rs index e9989f0f481..baa05c36a9d 100644 --- a/tests/ui/array-slice-vec/slice-mut.rs +++ b/tests/ui/array-slice-vec/slice-mut.rs @@ -6,7 +6,8 @@ fn main() { let y: &mut[_] = &x[2..4]; //~^ ERROR mismatched types - //~| expected mutable reference `&mut [_]` - //~| found reference `&[isize]` - //~| types differ in mutability + //~| NOTE expected mutable reference `&mut [_]` + //~| NOTE found reference `&[isize]` + //~| NOTE types differ in mutability + //~| NOTE expected due to this } |
