fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
4.3 KiB138 linesraw
1error[E0423]: expected value, found struct `Z`
2  --> $DIR/privacy-struct-ctor.rs:20:9
3   |
4LL |     pub struct S(u8);
5   |     ----------------- similarly named tuple struct `S` defined here
6...
7LL |         Z;
8   |         ^
9   |         |
10   |         constructor is not visible here due to private fields
11   |         help: a tuple struct with a similar name exists: `S`
12
13error[E0423]: expected value, found struct `S`
14  --> $DIR/privacy-struct-ctor.rs:33:5
15   |
16LL |     S;
17   |     ^ constructor is not visible here due to private fields
18
19error[E0423]: expected value, found struct `S2`
20  --> $DIR/privacy-struct-ctor.rs:38:5
21   |
22LL | /     pub struct S2 {
23LL | |         s: u8
24LL | |     }
25   | |_____- `S2` defined here
26...
27LL |       S2;
28   |       ^^ did you mean `S2 { /* fields */ }`?
29
30error[E0423]: expected value, found struct `xcrate::S`
31  --> $DIR/privacy-struct-ctor.rs:43:5
32   |
33LL |     xcrate::S;
34   |     ^^^^^^^^^ constructor is not visible here due to private fields
35   |
36help: possible better candidate is found in another module, you can import it into scope
37   |
38LL | use m::S;
39   |
40
41error[E0603]: tuple struct constructor `Z` is private
42  --> $DIR/privacy-struct-ctor.rs:18:12
43   |
44LL |         pub(in m) struct Z(pub(in m::n) u8);
45   |                            --------------- a constructor is private if any of the fields is private
46...
47LL |         n::Z;
48   |            ^ this tuple struct constructor is private
49   |
50note: the tuple struct constructor `Z` is defined here
51  --> $DIR/privacy-struct-ctor.rs:12:9
52   |
53LL |         pub(in m) struct Z(pub(in m::n) u8);
54   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55
56error[E0603]: tuple struct constructor `S` is private
57  --> $DIR/privacy-struct-ctor.rs:29:8
58   |
59LL |     pub struct S(u8);
60   |                  -- a constructor is private if any of the fields is private
61...
62LL |     m::S;
63   |        ^ this tuple struct constructor is private
64   |
65note: the tuple struct constructor `S` is defined here
66  --> $DIR/privacy-struct-ctor.rs:6:5
67   |
68LL |     pub struct S(u8);
69   |     ^^^^^^^^^^^^^^^^^
70
71error[E0603]: tuple struct constructor `S` is private
72  --> $DIR/privacy-struct-ctor.rs:31:19
73   |
74LL |     pub struct S(u8);
75   |                  -- a constructor is private if any of the fields is private
76...
77LL |     let _: S = m::S(2);
78   |                   ^ this tuple struct constructor is private
79   |
80note: the tuple struct constructor `S` is defined here
81  --> $DIR/privacy-struct-ctor.rs:6:5
82   |
83LL |     pub struct S(u8);
84   |     ^^^^^^^^^^^^^^^^^
85
86error[E0603]: tuple struct constructor `Z` is private
87  --> $DIR/privacy-struct-ctor.rs:35:11
88   |
89LL |         pub(in m) struct Z(pub(in m::n) u8);
90   |                            --------------- a constructor is private if any of the fields is private
91...
92LL |     m::n::Z;
93   |           ^ this tuple struct constructor is private
94   |
95note: the tuple struct constructor `Z` is defined here
96  --> $DIR/privacy-struct-ctor.rs:12:9
97   |
98LL |         pub(in m) struct Z(pub(in m::n) u8);
99   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
101error[E0603]: tuple struct constructor `S` is private
102  --> $DIR/privacy-struct-ctor.rs:41:16
103   |
104LL |     xcrate::m::S;
105   |                ^ this tuple struct constructor is private
106   | 
107  ::: $DIR/auxiliary/privacy-struct-ctor.rs:2:18
108   |
109LL |     pub struct S(u8);
110   |                  -- a constructor is private if any of the fields is private
111   |
112note: the tuple struct constructor `S` is defined here
113  --> $DIR/auxiliary/privacy-struct-ctor.rs:2:5
114   |
115LL |     pub struct S(u8);
116   |     ^^^^^^^^^^^^^^^^^
117
118error[E0603]: tuple struct constructor `Z` is private
119  --> $DIR/privacy-struct-ctor.rs:45:19
120   |
121LL |     xcrate::m::n::Z;
122   |                   ^ this tuple struct constructor is private
123   | 
124  ::: $DIR/auxiliary/privacy-struct-ctor.rs:5:28
125   |
126LL |         pub(in m) struct Z(pub(in m::n) u8);
127   |                            --------------- a constructor is private if any of the fields is private
128   |
129note: the tuple struct constructor `Z` is defined here
130  --> $DIR/auxiliary/privacy-struct-ctor.rs:5:9
131   |
132LL |         pub(in m) struct Z(pub(in m::n) u8);
133   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134
135error: aborting due to 10 previous errors
136
137Some errors have detailed explanations: E0423, E0603.
138For more information about an error, try `rustc --explain E0423`.