diff --git a/test_suite/tests/ui/conflict/alias-enum.rs b/test_suite/tests/ui/conflict/alias-enum.rs index faceae3e7..e5e614e29 100644 --- a/test_suite/tests/ui/conflict/alias-enum.rs +++ b/test_suite/tests/ui/conflict/alias-enum.rs @@ -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: (), @@ -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, @@ -57,11 +51,10 @@ 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, } @@ -69,10 +62,11 @@ enum E2 { #[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, } diff --git a/test_suite/tests/ui/conflict/alias-enum.stderr b/test_suite/tests/ui/conflict/alias-enum.stderr index aa0ca687c..ea2ed1009 100644 --- a/test_suite/tests/ui/conflict/alias-enum.stderr +++ b/test_suite/tests/ui/conflict/alias-enum.stderr @@ -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 diff --git a/test_suite/tests/ui/conflict/alias.rs b/test_suite/tests/ui/conflict/alias.rs index 3f6cee295..8158301c2 100644 --- a/test_suite/tests/ui/conflict/alias.rs +++ b/test_suite/tests/ui/conflict/alias.rs @@ -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: (), @@ -18,11 +15,10 @@ 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: (), } @@ -30,10 +26,11 @@ struct S2 { #[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: (), } diff --git a/test_suite/tests/ui/conflict/alias.stderr b/test_suite/tests/ui/conflict/alias.stderr index 7e665a630..2040cec32 100644 --- a/test_suite/tests/ui/conflict/alias.stderr +++ b/test_suite/tests/ui/conflict/alias.stderr @@ -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