Skip to content

Commit

Permalink
Update PR 2562 ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 11, 2024
1 parent 7d96352 commit 1a3cf4b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 70 deletions.
26 changes: 10 additions & 16 deletions test_suite/tests/ui/conflict/alias-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ use serde_derive::Deserialize;
#[derive(Deserialize)]
enum E {
S1 {
/// Expected error on "alias b", because this is a name of other field
/// Error on "alias a" is not expected because this is a name of this field
/// Error on "alias c" is not expected because field `c` is skipped
#[serde(alias = "a", alias = "b", alias = "c")]
a: (),

/// Expected error on "alias c", because it is already used as alias of `a`
// Warning on "c" and "b"
#[serde(alias = "c")]
b: (),

Expand All @@ -20,34 +17,31 @@ enum E {
},

S2 {
/// Expected error on "alias c", because this is a name of other field after
/// applying rename rules
#[serde(alias = "b", alias = "c")]
a: (),

// Warning on "c"
#[serde(rename = "c")]
b: (),
},

#[serde(rename_all = "UPPERCASE")]
S3 {
/// Expected error on "alias B", because this is a name of field after
/// applying rename rules
#[serde(alias = "B", alias = "c")]
a: (),

// Warning on "b" because this collides with the "B" above after
// applying rename rules
b: (),
},
}

#[derive(Deserialize)]
enum E1 {
/// Expected error on "alias b", because this is a name of other variant
/// Error on "alias a" is not expected because this is a name of this variant
/// Error on "alias c" is not expected because variant `c` is skipped
#[serde(alias = "a", alias = "b", alias = "c")]
a,

/// Expected error on "alias c", because it is already used as alias of `a`
// Warning on "c" and "b"
#[serde(alias = "c")]
b,

Expand All @@ -57,22 +51,22 @@ enum E1 {

#[derive(Deserialize)]
enum E2 {
/// Expected error on "alias c", because this is a name of other variant after
/// applying rename rules
#[serde(alias = "b", alias = "c")]
a,

// Warning on "c"
#[serde(rename = "c")]
b,
}

#[derive(Deserialize)]
#[serde(rename_all = "UPPERCASE")]
enum E3 {
/// Expected error on "alias B", because this is a name of variant after
/// applying rename rules
#[serde(alias = "B", alias = "c")]
a,

// Warning on "b" because this collides with the "B" above after applying
// rename rules
b,
}

Expand Down
56 changes: 28 additions & 28 deletions test_suite/tests/ui/conflict/alias-enum.stderr
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
error: expected expression, found `@`
--> tests/ui/conflict/alias-enum.rs:80:5
--> tests/ui/conflict/alias-enum.rs:74:5
|
80 | @//fail
74 | @//fail
| ^ expected expression

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:16:9
--> tests/ui/conflict/alias-enum.rs:13:9
|
11 | #[serde(alias = "a", alias = "b", alias = "c")]
8 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
...
16 | b: (),
13 | b: (),
| ^ no value can reach this
|
= note: `#[warn(unreachable_patterns)]` on by default

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:15:25
--> tests/ui/conflict/alias-enum.rs:12:25
|
11 | #[serde(alias = "a", alias = "b", alias = "c")]
8 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
...
15 | #[serde(alias = "c")]
12 | #[serde(alias = "c")]
| ^^^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:28:26
--> tests/ui/conflict/alias-enum.rs:24:26
|
25 | #[serde(alias = "b", alias = "c")]
20 | #[serde(alias = "b", alias = "c")]
| --- matches all the relevant values
...
28 | #[serde(rename = "c")]
24 | #[serde(rename = "c")]
| ^^^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:38:9
--> tests/ui/conflict/alias-enum.rs:35:9
|
36 | #[serde(alias = "B", alias = "c")]
30 | #[serde(alias = "B", alias = "c")]
| --- matches all the relevant values
37 | a: (),
38 | b: (),
...
35 | b: (),
| ^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:52:5
--> tests/ui/conflict/alias-enum.rs:46:5
|
47 | #[serde(alias = "a", alias = "b", alias = "c")]
41 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
...
52 | b,
46 | b,
| ^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:51:21
--> tests/ui/conflict/alias-enum.rs:45:21
|
47 | #[serde(alias = "a", alias = "b", alias = "c")]
41 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
...
51 | #[serde(alias = "c")]
45 | #[serde(alias = "c")]
| ^^^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:65:22
--> tests/ui/conflict/alias-enum.rs:58:22
|
62 | #[serde(alias = "b", alias = "c")]
54 | #[serde(alias = "b", alias = "c")]
| --- matches all the relevant values
...
65 | #[serde(rename = "c")]
58 | #[serde(rename = "c")]
| ^^^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias-enum.rs:76:5
--> tests/ui/conflict/alias-enum.rs:70:5
|
74 | #[serde(alias = "B", alias = "c")]
65 | #[serde(alias = "B", alias = "c")]
| --- matches all the relevant values
75 | a,
76 | b,
...
70 | b,
| ^ no value can reach this
13 changes: 5 additions & 8 deletions test_suite/tests/ui/conflict/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ use serde_derive::Deserialize;

#[derive(Deserialize)]
struct S1 {
/// Expected error on "alias b", because this is a name of other field
/// Error on "alias a" is not expected because this is a name of this field
/// Error on "alias c" is not expected because field `c` is skipped
#[serde(alias = "a", alias = "b", alias = "c")]
a: (),

/// Expected error on "alias c", because it is already used as alias of `a`
// Warning on "c" and "b"
#[serde(alias = "c")]
b: (),

Expand All @@ -18,22 +15,22 @@ struct S1 {

#[derive(Deserialize)]
struct S2 {
/// Expected error on "alias c", because this is a name of other field after
/// applying rename rules
#[serde(alias = "b", alias = "c")]
a: (),

// Warning on "c"
#[serde(rename = "c")]
b: (),
}

#[derive(Deserialize)]
#[serde(rename_all = "UPPERCASE")]
struct S3 {
/// Expected error on "alias B", because this is a name of field after
/// applying rename rules
#[serde(alias = "B", alias = "c")]
a: (),

// Warning on "b" because this collides with the "B" above after applying
// rename rules
b: (),
}

Expand Down
36 changes: 18 additions & 18 deletions test_suite/tests/ui/conflict/alias.stderr
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
error: expected expression, found `@`
--> tests/ui/conflict/alias.rs:41:5
--> tests/ui/conflict/alias.rs:38:5
|
41 | @//fail
38 | @//fail
| ^ expected expression

warning: unreachable pattern
--> tests/ui/conflict/alias.rs:13:5
--> tests/ui/conflict/alias.rs:10:5
|
8 | #[serde(alias = "a", alias = "b", alias = "c")]
5 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
...
13 | b: (),
10 | b: (),
| ^ no value can reach this
|
= note: `#[warn(unreachable_patterns)]` on by default

warning: unreachable pattern
--> tests/ui/conflict/alias.rs:12:21
|
8 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
--> tests/ui/conflict/alias.rs:9:21
|
5 | #[serde(alias = "a", alias = "b", alias = "c")]
| --- matches all the relevant values
...
12 | #[serde(alias = "c")]
| ^^^ no value can reach this
9 | #[serde(alias = "c")]
| ^^^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias.rs:26:22
--> tests/ui/conflict/alias.rs:22:22
|
23 | #[serde(alias = "b", alias = "c")]
18 | #[serde(alias = "b", alias = "c")]
| --- matches all the relevant values
...
26 | #[serde(rename = "c")]
22 | #[serde(rename = "c")]
| ^^^ no value can reach this

warning: unreachable pattern
--> tests/ui/conflict/alias.rs:37:5
--> tests/ui/conflict/alias.rs:34:5
|
35 | #[serde(alias = "B", alias = "c")]
29 | #[serde(alias = "B", alias = "c")]
| --- matches all the relevant values
36 | a: (),
37 | b: (),
...
34 | b: (),
| ^ no value can reach this

0 comments on commit 1a3cf4b

Please sign in to comment.