diff options
Diffstat (limited to 'tests/ui/structs')
11 files changed, 99 insertions, 66 deletions
diff --git a/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr b/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr index 63793425657..c7689cfd323 100644 --- a/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr +++ b/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr @@ -66,8 +66,9 @@ LL | let _ = S { }; | help: all remaining fields have default values, if you added `#![feature(default_field_values)]` to your crate you could use those values with `..` | -LL | let _ = S { .. }; - | ~~~~~~ +LL - let _ = S { }; +LL + let _ = S { .. }; + | error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:26:13 diff --git a/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr b/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr index 6d035ebdc47..d9b8e76aa0d 100644 --- a/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr +++ b/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr @@ -6,8 +6,9 @@ LL | let _ = S { }; | help: all remaining fields have default values, you can use those values with `..` | -LL | let _ = S { .. }; - | ~~~~~~ +LL - let _ = S { }; +LL + let _ = S { .. }; + | error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:26:13 diff --git a/tests/ui/structs/struct-field-cfg.stderr b/tests/ui/structs/struct-field-cfg.stderr index f30d343d582..2bca6f302db 100644 --- a/tests/ui/structs/struct-field-cfg.stderr +++ b/tests/ui/structs/struct-field-cfg.stderr @@ -20,16 +20,19 @@ LL | let Foo { #[cfg(any())] present: () } = foo; | help: include the missing field in the pattern | -LL | let Foo { present } = foo; - | ~~~~~~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { present } = foo; + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let Foo { present: _ } = foo; - | ~~~~~~~~~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { present: _ } = foo; + | help: or always ignore missing fields here | -LL | let Foo { .. } = foo; - | ~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { .. } = foo; + | error[E0026]: struct `Foo` does not have a field named `absent` --> $DIR/struct-field-cfg.rs:16:42 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 2b88d802833..650f6ddfa88 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -6,8 +6,9 @@ LL | bar : 42, | help: a field with a similar name exists | -LL | barr : 42, - | ~~~~ +LL - bar : 42, +LL + barr : 42, + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-fields-hints.stderr b/tests/ui/structs/struct-fields-hints.stderr index 8217d7a6e81..6526e49600e 100644 --- a/tests/ui/structs/struct-fields-hints.stderr +++ b/tests/ui/structs/struct-fields-hints.stderr @@ -6,8 +6,9 @@ LL | bar : 42, | help: a field with a similar name exists | -LL | car : 42, - | ~~~ +LL - bar : 42, +LL + car : 42, + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-fields-typo.stderr b/tests/ui/structs/struct-fields-typo.stderr index d87bace7277..dacf2ecea17 100644 --- a/tests/ui/structs/struct-fields-typo.stderr +++ b/tests/ui/structs/struct-fields-typo.stderr @@ -6,8 +6,9 @@ LL | let x = foo.baa; | help: a field with a similar name exists | -LL | let x = foo.bar; - | ~~~ +LL - let x = foo.baa; +LL + let x = foo.bar; + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index d1d68121cf1..a086de08983 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -6,8 +6,9 @@ LL | let A { x, y } = self.d; | help: a field with a similar name exists | -LL | let A { x, y } = self.b; - | ~ +LL - let A { x, y } = self.d; +LL + let A { x, y } = self.b; + | error[E0026]: struct `A` does not have fields named `x`, `y` --> $DIR/struct-pat-derived-error.rs:8:17 @@ -23,16 +24,19 @@ LL | let A { x, y } = self.d; | help: include the missing fields in the pattern | -LL | let A { x, y, b, c } = self.d; - | ~~~~~~~~ +LL - let A { x, y } = self.d; +LL + let A { x, y, b, c } = self.d; + | help: if you don't care about these missing fields, you can explicitly ignore them | -LL | let A { x, y, b: _, c: _ } = self.d; - | ~~~~~~~~~~~~~~ +LL - let A { x, y } = self.d; +LL + let A { x, y, b: _, c: _ } = self.d; + | help: or always ignore missing fields here | -LL | let A { x, y, .. } = self.d; - | ~~~~~~ +LL - let A { x, y } = self.d; +LL + let A { x, y, .. } = self.d; + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-path-self-type-mismatch.stderr b/tests/ui/structs/struct-path-self-type-mismatch.stderr index bbe5bae29bb..6517d7f00dd 100644 --- a/tests/ui/structs/struct-path-self-type-mismatch.stderr +++ b/tests/ui/structs/struct-path-self-type-mismatch.stderr @@ -44,8 +44,9 @@ LL | | } = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters help: use the type name directly | -LL | Foo::<U> { - | ~~~~~~~~ +LL - Self { +LL + Foo::<U> { + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 5f1ab2f9d68..7692010aa54 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -6,8 +6,9 @@ LL | E::S { 0, 1 } => {} | help: use the tuple variant pattern syntax instead | -LL | E::S(_, _) => {} - | ~~~~~~ +LL - E::S { 0, 1 } => {} +LL + E::S(_, _) => {} + | error[E0769]: tuple variant `S` written as struct variant --> $DIR/struct-tuple-field-names.rs:13:9 @@ -17,8 +18,9 @@ LL | S { } => {} | help: use the tuple variant pattern syntax instead | -LL | S(_, _) => {} - | ~~~~~~ +LL - S { } => {} +LL + S(_, _) => {} + | error[E0027]: pattern does not mention field `1` --> $DIR/struct-tuple-field-names.rs:16:12 @@ -28,16 +30,19 @@ LL | if let E::S { 0: a } = x { | help: include the missing field in the pattern | -LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ +LL - if let E::S { 0: a } = x { +LL + if let E::S { 0: a, 1: _ } = x { + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ +LL - if let E::S { 0: a } = x { +LL + if let E::S { 0: a, 1: _ } = x { + | help: or always ignore missing fields here | -LL | if let E::S { 0: a, .. } = x { - | ~~~~~~ +LL - if let E::S { 0: a } = x { +LL + if let E::S { 0: a, .. } = x { + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-private-fields.stderr b/tests/ui/structs/suggest-private-fields.stderr index f67a4ed78e2..adf90f0e1fd 100644 --- a/tests/ui/structs/suggest-private-fields.stderr +++ b/tests/ui/structs/suggest-private-fields.stderr @@ -6,8 +6,9 @@ LL | aa: 20, | help: a field with a similar name exists | -LL | a: 20, - | ~ +LL - aa: 20, +LL + a: 20, + | error[E0560]: struct `B` has no field named `bb` --> $DIR/suggest-private-fields.rs:17:9 @@ -25,8 +26,9 @@ LL | aa: 20, | help: a field with a similar name exists | -LL | a: 20, - | ~ +LL - aa: 20, +LL + a: 20, + | error[E0560]: struct `A` has no field named `bb` --> $DIR/suggest-private-fields.rs:24:9 @@ -36,8 +38,9 @@ LL | bb: 20, | help: a field with a similar name exists | -LL | b: 20, - | ~ +LL - bb: 20, +LL + b: 20, + | error: aborting due to 4 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index af530e2b759..befc6a1b538 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -15,16 +15,19 @@ LL | Foo::Bar { a, aa: 1, c } => (), | help: include the missing field in the pattern | -LL | Foo::Bar { a, aa: 1, c, b } => (), - | ~~~~~ +LL - Foo::Bar { a, aa: 1, c } => (), +LL + Foo::Bar { a, aa: 1, c, b } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Bar { a, aa: 1, c, b: _ } => (), - | ~~~~~~~~ +LL - Foo::Bar { a, aa: 1, c } => (), +LL + Foo::Bar { a, aa: 1, c, b: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Bar { a, aa: 1, c, .. } => (), - | ~~~~~~ +LL - Foo::Bar { a, aa: 1, c } => (), +LL + Foo::Bar { a, aa: 1, c, .. } => (), + | error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -43,16 +46,19 @@ LL | Foo::Baz { bb: 1.0 } => (), | help: include the missing field in the pattern | -LL | Foo::Baz { bb: 1.0, a } => (), - | ~~~~~ +LL - Foo::Baz { bb: 1.0 } => (), +LL + Foo::Baz { bb: 1.0, a } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Baz { bb: 1.0, a: _ } => (), - | ~~~~~~~~ +LL - Foo::Baz { bb: 1.0 } => (), +LL + Foo::Baz { bb: 1.0, a: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Baz { bb: 1.0, .. } => (), - | ~~~~~~ +LL - Foo::Baz { bb: 1.0 } => (), +LL + Foo::Baz { bb: 1.0, .. } => (), + | error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -68,16 +74,19 @@ LL | Foo::Bar { a, aa: "", c } => (), | help: include the missing field in the pattern | -LL | Foo::Bar { a, aa: "", c, b } => (), - | ~~~~~ +LL - Foo::Bar { a, aa: "", c } => (), +LL + Foo::Bar { a, aa: "", c, b } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Bar { a, aa: "", c, b: _ } => (), - | ~~~~~~~~ +LL - Foo::Bar { a, aa: "", c } => (), +LL + Foo::Bar { a, aa: "", c, b: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Bar { a, aa: "", c, .. } => (), - | ~~~~~~ +LL - Foo::Bar { a, aa: "", c } => (), +LL + Foo::Bar { a, aa: "", c, .. } => (), + | error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -93,16 +102,19 @@ LL | Foo::Baz { bb: "" } => (), | help: include the missing field in the pattern | -LL | Foo::Baz { bb: "", a } => (), - | ~~~~~ +LL - Foo::Baz { bb: "" } => (), +LL + Foo::Baz { bb: "", a } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Baz { bb: "", a: _ } => (), - | ~~~~~~~~ +LL - Foo::Baz { bb: "" } => (), +LL + Foo::Baz { bb: "", a: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Baz { bb: "", .. } => (), - | ~~~~~~ +LL - Foo::Baz { bb: "" } => (), +LL + Foo::Baz { bb: "", .. } => (), + | error: aborting due to 8 previous errors |
