fork/rust

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

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

master
1.3 KiB39 linesraw
1error[E0603]: tuple struct constructor `A` is private
2  --> $DIR/suggest-making-field-public.rs:13:8
3   |
4LL |     pub struct A(pub(self)String);
5   |                  --------------- a constructor is private if any of the fields is private
6...
7LL |     a::A("a".into());
8   |        ^ private tuple struct constructor
9   |
10note: the tuple struct constructor `A` is defined here
11  --> $DIR/suggest-making-field-public.rs:3:5
12   |
13LL |     pub struct A(pub(self)String);
14   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15help: consider making the field publicly accessible
16   |
17LL |     pub struct A(pub String);
18   |                  ~~~
19
20error[E0423]: cannot initialize a tuple struct which contains private fields
21  --> $DIR/suggest-making-field-public.rs:9:9
22   |
23LL |         A("".into());
24   |         ^
25   |
26note: constructor is not visible here due to private fields
27  --> $DIR/suggest-making-field-public.rs:3:18
28   |
29LL |     pub struct A(pub(self)String);
30   |                  ^^^^^^^^^^^^^^^ private field
31help: consider making the field publicly accessible
32   |
33LL |     pub struct A(pub String);
34   |                  ~~~
35
36error: aborting due to 2 previous errors
37
38Some errors have detailed explanations: E0423, E0603.
39For more information about an error, try `rustc --explain E0423`.