]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/item-privacy.stderr
Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett
[rust.git] / src / test / ui / traits / item-privacy.stderr
1 error[E0599]: no method named `a` found for struct `S` in the current scope
2   --> $DIR/item-privacy.rs:67:7
3    |
4 LL | struct S;
5    | --------- method `a` not found for this
6 ...
7 LL |     S.a();
8    |       ^ method not found in `S`
9    |
10    = help: items from traits can only be used if the trait is implemented and in scope
11 note: `method::A` defines an item `a`, perhaps you need to implement it
12   --> $DIR/item-privacy.rs:6:5
13    |
14 LL |     trait A {
15    |     ^^^^^^^
16
17 error[E0599]: no method named `b` found for struct `S` in the current scope
18   --> $DIR/item-privacy.rs:68:7
19    |
20 LL | struct S;
21    | --------- method `b` not found for this
22 ...
23 LL |         fn b(&self) { }
24    |            - the method is available for `S` here
25 ...
26 LL |     S.b();
27    |       ^ method not found in `S`
28    |
29    = help: items from traits can only be used if the trait is in scope
30 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
31    |
32 LL | use method::B;
33    |
34
35 error[E0624]: associated function `a` is private
36   --> $DIR/item-privacy.rs:72:7
37    |
38 LL |     c.a();
39    |       ^ private associated function
40
41 error[E0599]: no function or associated item named `a` found for struct `S` in the current scope
42   --> $DIR/item-privacy.rs:78:8
43    |
44 LL | struct S;
45    | --------- function or associated item `a` not found for this
46 ...
47 LL |     S::a(&S);
48    |        ^ function or associated item not found in `S`
49    |
50    = help: items from traits can only be used if the trait is implemented and in scope
51 note: `method::A` defines an item `a`, perhaps you need to implement it
52   --> $DIR/item-privacy.rs:6:5
53    |
54 LL |     trait A {
55    |     ^^^^^^^
56
57 error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
58   --> $DIR/item-privacy.rs:80:8
59    |
60 LL | struct S;
61    | --------- function or associated item `b` not found for this
62 ...
63 LL |     S::b(&S);
64    |        ^ function or associated item not found in `S`
65    |
66    = help: items from traits can only be used if the trait is in scope
67 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
68    |
69 LL | use method::B;
70    |
71
72 error[E0624]: associated function `a` is private
73   --> $DIR/item-privacy.rs:84:14
74    |
75 LL |     <dyn C>::a(&S);
76    |              ^ private associated function
77
78 error[E0599]: no associated item named `A` found for struct `S` in the current scope
79   --> $DIR/item-privacy.rs:97:8
80    |
81 LL | struct S;
82    | --------- associated item `A` not found for this
83 ...
84 LL |     S::A;
85    |        ^ associated item not found in `S`
86    |
87    = help: items from traits can only be used if the trait is implemented and in scope
88 note: `assoc_const::A` defines an item `A`, perhaps you need to implement it
89   --> $DIR/item-privacy.rs:24:5
90    |
91 LL |     trait A {
92    |     ^^^^^^^
93
94 error[E0599]: no associated item named `B` found for struct `S` in the current scope
95   --> $DIR/item-privacy.rs:98:8
96    |
97 LL | struct S;
98    | --------- associated item `B` not found for this
99 ...
100 LL |     S::B;
101    |        ^ associated item not found in `S`
102    |
103    = help: items from traits can only be used if the trait is in scope
104 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
105    |
106 LL | use assoc_const::B;
107    |
108
109 error[E0624]: associated constant `A` is private
110   --> $DIR/item-privacy.rs:101:14
111    |
112 LL |     <dyn C>::A;
113    |              ^ private associated constant
114
115 error[E0038]: the trait `assoc_const::C` cannot be made into an object
116   --> $DIR/item-privacy.rs:101:6
117    |
118 LL |     <dyn C>::A;
119    |      ^^^^^ `assoc_const::C` cannot be made into an object
120    |
121    = help: consider moving `C` to another trait
122    = help: consider moving `B` to another trait
123    = help: consider moving `A` to another trait
124 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
125   --> $DIR/item-privacy.rs:25:15
126    |
127 LL |         const A: u8 = 0;
128    |               ^ ...because it contains this associated `const`
129 ...
130 LL |         const B: u8 = 0;
131    |               ^ ...because it contains this associated `const`
132 ...
133 LL |     pub trait C: A + B {
134    |               - this trait cannot be made into an object...
135 LL |         const C: u8 = 0;
136    |               ^ ...because it contains this associated `const`
137
138 error[E0223]: ambiguous associated type
139   --> $DIR/item-privacy.rs:115:12
140    |
141 LL |     let _: S::A;
142    |            ^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
143
144 error[E0223]: ambiguous associated type
145   --> $DIR/item-privacy.rs:116:12
146    |
147 LL |     let _: S::B;
148    |            ^^^^ help: use fully-qualified syntax: `<S as Trait>::B`
149
150 error[E0223]: ambiguous associated type
151   --> $DIR/item-privacy.rs:117:12
152    |
153 LL |     let _: S::C;
154    |            ^^^^ help: use fully-qualified syntax: `<S as Trait>::C`
155
156 error: associated type `A` is private
157   --> $DIR/item-privacy.rs:119:12
158    |
159 LL |     let _: T::A;
160    |            ^^^^ private associated type
161
162 error: associated type `A` is private
163   --> $DIR/item-privacy.rs:128:9
164    |
165 LL |         A = u8,
166    |         ^^^^^^ private associated type
167
168 error: aborting due to 15 previous errors
169
170 Some errors have detailed explanations: E0038, E0223, E0599, E0624.
171 For more information about an error, try `rustc --explain E0038`.