fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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