]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2008-non-exhaustive/struct.stderr
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
[rust.git] / src / test / ui / rfc-2008-non-exhaustive / struct.stderr
1 error[E0423]: expected value, found struct `UnitStruct`
2   --> $DIR/struct.rs:29:14
3    |
4 LL |     let us = UnitStruct;
5    |              ^^^^^^^^^^ constructor is not visible here due to private fields
6
7 error[E0603]: tuple struct constructor `TupleStruct` is private
8   --> $DIR/struct.rs:23:32
9    |
10 LL |     let ts_explicit = structs::TupleStruct(640, 480);
11    |                                ^^^^^^^^^^^ private tuple struct constructor
12    |
13   ::: $DIR/auxiliary/structs.rs:12:24
14    |
15 LL | pub struct TupleStruct(pub u16, pub u16);
16    |                        ---------------- a constructor is private if any of the fields is private
17    |
18 note: the tuple struct constructor `TupleStruct` is defined here
19   --> $DIR/auxiliary/structs.rs:12:1
20    |
21 LL | pub struct TupleStruct(pub u16, pub u16);
22    | ^^^^^^^^^^^^^^^^^^^^^^
23
24 error[E0603]: unit struct `UnitStruct` is private
25   --> $DIR/struct.rs:32:32
26    |
27 LL |     let us_explicit = structs::UnitStruct;
28    |                                ^^^^^^^^^^ private unit struct
29    |
30 note: the unit struct `UnitStruct` is defined here
31   --> $DIR/auxiliary/structs.rs:9:1
32    |
33 LL | pub struct UnitStruct;
34    | ^^^^^^^^^^^^^^^^^^^^^
35
36 error[E0639]: cannot create non-exhaustive struct using struct expression
37   --> $DIR/struct.rs:7:14
38    |
39 LL |       let fr = FunctionalRecord {
40    |  ______________^
41 LL | |
42 LL | |         first_field: 1920,
43 LL | |         second_field: 1080,
44 LL | |         ..FunctionalRecord::default()
45 LL | |     };
46    | |_____^
47
48 error[E0639]: cannot create non-exhaustive struct using struct expression
49   --> $DIR/struct.rs:14:14
50    |
51 LL |     let ns = NormalStruct { first_field: 640, second_field: 480 };
52    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53
54 error[E0638]: `..` required with struct marked as non-exhaustive
55   --> $DIR/struct.rs:17:9
56    |
57 LL |     let NormalStruct { first_field, second_field } = ns;
58    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59    |
60 help: add `..` at the end of the field list to ignore all other fields
61    |
62 LL |     let NormalStruct { first_field, second_field , .. } = ns;
63    |                                                  ~~~~~~
64
65 error[E0423]: cannot initialize a tuple struct which contains private fields
66   --> $DIR/struct.rs:20:14
67    |
68 LL |     let ts = TupleStruct(640, 480);
69    |              ^^^^^^^^^^^
70
71 error[E0638]: `..` required with struct marked as non-exhaustive
72   --> $DIR/struct.rs:26:9
73    |
74 LL |     let TupleStruct { 0: first_field, 1: second_field } = ts;
75    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76    |
77 help: add `..` at the end of the field list to ignore all other fields
78    |
79 LL |     let TupleStruct { 0: first_field, 1: second_field , .. } = ts;
80    |                                                       ~~~~~~
81
82 error[E0638]: `..` required with struct marked as non-exhaustive
83   --> $DIR/struct.rs:35:9
84    |
85 LL |     let UnitStruct { } = us;
86    |         ^^^^^^^^^^^^^^
87    |
88 help: add `..` at the end of the field list to ignore all other fields
89    |
90 LL |     let UnitStruct { .. } = us;
91    |                      ~~~~
92
93 error: aborting due to 9 previous errors
94
95 Some errors have detailed explanations: E0423, E0603, E0638, E0639.
96 For more information about an error, try `rustc --explain E0423`.