about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/issues/issue-4736.stderr9
-rw-r--r--src/test/ui/issues/issue-80607.stderr9
-rw-r--r--src/test/ui/numeric/numeric-fields.stderr9
-rw-r--r--src/test/ui/suggestions/nested-non-tuple-tuple-struct.rs18
-rw-r--r--src/test/ui/suggestions/nested-non-tuple-tuple-struct.stderr116
5 files changed, 152 insertions, 9 deletions
diff --git a/src/test/ui/issues/issue-4736.stderr b/src/test/ui/issues/issue-4736.stderr
index 9be4eb1c7fd..2a1f1819c33 100644
--- a/src/test/ui/issues/issue-4736.stderr
+++ b/src/test/ui/issues/issue-4736.stderr
@@ -5,9 +5,12 @@ LL | struct NonCopyable(());
    |        ----------- `NonCopyable` defined here
 ...
 LL |     let z = NonCopyable{ p: () };
-   |             -----------  ^ field does not exist
-   |             |
-   |             help: `NonCopyable` is a tuple struct, use the appropriate syntax: `NonCopyable(/* fields */)`
+   |                          ^ field does not exist
+   |
+help: `NonCopyable` is a tuple struct, use the appropriate syntax
+   |
+LL |     let z = NonCopyable(/* fields */);
+   |             ~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-80607.stderr b/src/test/ui/issues/issue-80607.stderr
index 22a660b4167..38e46683b08 100644
--- a/src/test/ui/issues/issue-80607.stderr
+++ b/src/test/ui/issues/issue-80607.stderr
@@ -5,9 +5,12 @@ LL |     V1(i32),
    |     -- `Enum::V1` defined here
 ...
 LL |     Enum::V1 { x }
-   |     --------   ^ field does not exist
-   |     |
-   |     help: `Enum::V1` is a tuple variant, use the appropriate syntax: `Enum::V1(/* fields */)`
+   |                ^ field does not exist
+   |
+help: `Enum::V1` is a tuple variant, use the appropriate syntax
+   |
+LL |     Enum::V1(/* fields */)
+   |     ~~~~~~~~~~~~~~~~~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/numeric/numeric-fields.stderr b/src/test/ui/numeric/numeric-fields.stderr
index 13b6cfae4ec..b328fbe2cfb 100644
--- a/src/test/ui/numeric/numeric-fields.stderr
+++ b/src/test/ui/numeric/numeric-fields.stderr
@@ -5,9 +5,12 @@ LL | struct S(u8, u16);
    |        - `S` defined here
 ...
 LL |     let s = S{0b1: 10, 0: 11};
-   |             - ^^^ field does not exist
-   |             |
-   |             help: `S` is a tuple struct, use the appropriate syntax: `S(/* fields */)`
+   |               ^^^ field does not exist
+   |
+help: `S` is a tuple struct, use the appropriate syntax
+   |
+LL |     let s = S(/* fields */);
+   |             ~~~~~~~~~~~~~~~
 
 error[E0026]: struct `S` does not have a field named `0x1`
   --> $DIR/numeric-fields.rs:7:17
diff --git a/src/test/ui/suggestions/nested-non-tuple-tuple-struct.rs b/src/test/ui/suggestions/nested-non-tuple-tuple-struct.rs
new file mode 100644
index 00000000000..308adcf01fe
--- /dev/null
+++ b/src/test/ui/suggestions/nested-non-tuple-tuple-struct.rs
@@ -0,0 +1,18 @@
+pub struct S(f32, f32);
+
+pub enum E {
+    V(f32, f32),
+}
+
+fn main() {
+    let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
+    //~^ ERROR struct `S` has no field named `x`
+    //~| ERROR struct `S` has no field named `y`
+    //~| ERROR struct `S` has no field named `x`
+    //~| ERROR struct `S` has no field named `y`
+    let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
+    //~^ ERROR variant `E::V` has no field named `x`
+    //~| ERROR variant `E::V` has no field named `y`
+    //~| ERROR variant `E::V` has no field named `x`
+    //~| ERROR variant `E::V` has no field named `y`
+}
diff --git a/src/test/ui/suggestions/nested-non-tuple-tuple-struct.stderr b/src/test/ui/suggestions/nested-non-tuple-tuple-struct.stderr
new file mode 100644
index 00000000000..948f09fc3fa
--- /dev/null
+++ b/src/test/ui/suggestions/nested-non-tuple-tuple-struct.stderr
@@ -0,0 +1,116 @@
+error[E0560]: struct `S` has no field named `x`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:8:19
+   |
+LL | pub struct S(f32, f32);
+   |            - `S` defined here
+...
+LL |     let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
+   |                   ^ field does not exist
+   |
+help: `S` is a tuple struct, use the appropriate syntax
+   |
+LL |     let _x = (S(/* fields */), S { x: 3.0, y: 4.0 });
+   |               ~~~~~~~~~~~~~~~
+
+error[E0560]: struct `S` has no field named `y`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:8:27
+   |
+LL | pub struct S(f32, f32);
+   |            - `S` defined here
+...
+LL |     let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
+   |                           ^ field does not exist
+   |
+help: `S` is a tuple struct, use the appropriate syntax
+   |
+LL |     let _x = (S(/* fields */), S { x: 3.0, y: 4.0 });
+   |               ~~~~~~~~~~~~~~~
+
+error[E0560]: struct `S` has no field named `x`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:8:41
+   |
+LL | pub struct S(f32, f32);
+   |            - `S` defined here
+...
+LL |     let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
+   |                                         ^ field does not exist
+   |
+help: `S` is a tuple struct, use the appropriate syntax
+   |
+LL |     let _x = (S { x: 1.0, y: 2.0 }, S(/* fields */));
+   |                                     ~~~~~~~~~~~~~~~
+
+error[E0560]: struct `S` has no field named `y`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:8:49
+   |
+LL | pub struct S(f32, f32);
+   |            - `S` defined here
+...
+LL |     let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 });
+   |                                                 ^ field does not exist
+   |
+help: `S` is a tuple struct, use the appropriate syntax
+   |
+LL |     let _x = (S { x: 1.0, y: 2.0 }, S(/* fields */));
+   |                                     ~~~~~~~~~~~~~~~
+
+error[E0559]: variant `E::V` has no field named `x`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:13:22
+   |
+LL |     V(f32, f32),
+   |     - `E::V` defined here
+...
+LL |     let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
+   |                      ^ field does not exist
+   |
+help: `E::V` is a tuple variant, use the appropriate syntax
+   |
+LL |     let _y = (E::V(/* fields */), E::V { x: 3.0, y: 4.0 });
+   |               ~~~~~~~~~~~~~~~~~~
+
+error[E0559]: variant `E::V` has no field named `y`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:13:30
+   |
+LL |     V(f32, f32),
+   |     - `E::V` defined here
+...
+LL |     let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
+   |                              ^ field does not exist
+   |
+help: `E::V` is a tuple variant, use the appropriate syntax
+   |
+LL |     let _y = (E::V(/* fields */), E::V { x: 3.0, y: 4.0 });
+   |               ~~~~~~~~~~~~~~~~~~
+
+error[E0559]: variant `E::V` has no field named `x`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:13:47
+   |
+LL |     V(f32, f32),
+   |     - `E::V` defined here
+...
+LL |     let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
+   |                                               ^ field does not exist
+   |
+help: `E::V` is a tuple variant, use the appropriate syntax
+   |
+LL |     let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* fields */));
+   |                                        ~~~~~~~~~~~~~~~~~~
+
+error[E0559]: variant `E::V` has no field named `y`
+  --> $DIR/nested-non-tuple-tuple-struct.rs:13:55
+   |
+LL |     V(f32, f32),
+   |     - `E::V` defined here
+...
+LL |     let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 });
+   |                                                       ^ field does not exist
+   |
+help: `E::V` is a tuple variant, use the appropriate syntax
+   |
+LL |     let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* fields */));
+   |                                        ~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0559, E0560.
+For more information about an error, try `rustc --explain E0559`.