summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr
blob: 39b1ef1e078c7e7af19feb8d05354b4ae61b7746 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
error[E0423]: expected value, found struct `UnitStruct`
  --> $DIR/struct.rs:29:14
   |
LL |     let us = UnitStruct;
   |              ^^^^^^^^^^ constructor is not visible here due to private fields

error[E0603]: tuple struct constructor `TupleStruct` is private
  --> $DIR/struct.rs:23:32
   |
LL |     let ts_explicit = structs::TupleStruct(640, 480);
   |                                ^^^^^^^^^^^ private tuple struct constructor
   |
note: the tuple struct constructor `TupleStruct` is defined here
  --> $DIR/auxiliary/structs.rs:12:1
   |
LL | #[non_exhaustive]
   | ----------------- cannot be constructed because it is `#[non_exhaustive]`
LL | pub struct TupleStruct(pub u16, pub u16);
   | ^^^^^^^^^^^^^^^^^^^^^^

error[E0603]: unit struct `UnitStruct` is private
  --> $DIR/struct.rs:32:32
   |
LL |     let us_explicit = structs::UnitStruct;
   |                                ^^^^^^^^^^ private unit struct
   |
note: the unit struct `UnitStruct` is defined here
  --> $DIR/auxiliary/structs.rs:9:1
   |
LL | #[non_exhaustive]
   | ----------------- cannot be constructed because it is `#[non_exhaustive]`
LL | pub struct UnitStruct;
   | ^^^^^^^^^^^^^^^^^^^^^

error[E0639]: cannot create non-exhaustive struct using struct expression
  --> $DIR/struct.rs:7:14
   |
LL |       let fr = FunctionalRecord {
   |  ______________^
LL | |
LL | |         first_field: 1920,
LL | |         second_field: 1080,
LL | |         ..FunctionalRecord::default()
LL | |     };
   | |_____^

error[E0639]: cannot create non-exhaustive struct using struct expression
  --> $DIR/struct.rs:14:14
   |
LL |     let ns = NormalStruct { first_field: 640, second_field: 480 };
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0638]: `..` required with struct marked as non-exhaustive
  --> $DIR/struct.rs:17:9
   |
LL |     let NormalStruct { first_field, second_field } = ns;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: add `..` at the end of the field list to ignore all other fields
   |
LL |     let NormalStruct { first_field, second_field , .. } = ns;
   |                                                  ~~~~~~

error[E0423]: cannot initialize a tuple struct which contains private fields
  --> $DIR/struct.rs:20:14
   |
LL |     let ts = TupleStruct(640, 480);
   |              ^^^^^^^^^^^

error[E0638]: `..` required with struct marked as non-exhaustive
  --> $DIR/struct.rs:26:9
   |
LL |     let TupleStruct { 0: first_field, 1: second_field } = ts;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: add `..` at the end of the field list to ignore all other fields
   |
LL |     let TupleStruct { 0: first_field, 1: second_field , .. } = ts;
   |                                                       ~~~~~~

error[E0638]: `..` required with struct marked as non-exhaustive
  --> $DIR/struct.rs:35:9
   |
LL |     let UnitStruct { } = us;
   |         ^^^^^^^^^^^^^^
   |
help: add `..` at the end of the field list to ignore all other fields
   |
LL |     let UnitStruct { .. } = us;
   |                      ~~~~

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0423, E0603, E0638, E0639.
For more information about an error, try `rustc --explain E0423`.