]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/item-privacy.stderr
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
[rust.git] / tests / 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 struct
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 struct
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 |         fn a(&self) { }
39    |         ----------- private associated function defined here
40 ...
41 LL |     c.a();
42    |       ^ private associated function
43
44 error[E0599]: no function or associated item named `a` found for struct `S` in the current scope
45   --> $DIR/item-privacy.rs:78:8
46    |
47 LL | struct S;
48    | -------- function or associated item `a` not found for this struct
49 ...
50 LL |     S::a(&S);
51    |        ^ function or associated item not found in `S`
52    |
53    = help: items from traits can only be used if the trait is implemented and in scope
54 note: `method::A` defines an item `a`, perhaps you need to implement it
55   --> $DIR/item-privacy.rs:6:5
56    |
57 LL |     trait A {
58    |     ^^^^^^^
59
60 error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
61   --> $DIR/item-privacy.rs:80:8
62    |
63 LL | struct S;
64    | -------- function or associated item `b` not found for this struct
65 ...
66 LL |     S::b(&S);
67    |        ^ function or associated item not found in `S`
68    |
69    = help: items from traits can only be used if the trait is in scope
70 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
71    |
72 LL | use method::B;
73    |
74
75 error[E0624]: associated function `a` is private
76   --> $DIR/item-privacy.rs:84:14
77    |
78 LL |         fn a(&self) { }
79    |         ----------- private associated function defined here
80 ...
81 LL |     <dyn C>::a(&S);
82    |              ^ private associated function
83
84 error[E0599]: no associated item named `A` found for struct `S` in the current scope
85   --> $DIR/item-privacy.rs:97:8
86    |
87 LL | struct S;
88    | -------- associated item `A` not found for this struct
89 ...
90 LL |     S::A;
91    |        ^ associated item not found in `S`
92    |
93    = help: items from traits can only be used if the trait is implemented and in scope
94 note: `assoc_const::A` defines an item `A`, perhaps you need to implement it
95   --> $DIR/item-privacy.rs:24:5
96    |
97 LL |     trait A {
98    |     ^^^^^^^
99
100 error[E0599]: no associated item named `B` found for struct `S` in the current scope
101   --> $DIR/item-privacy.rs:98:8
102    |
103 LL | struct S;
104    | -------- associated item `B` not found for this struct
105 ...
106 LL |     S::B;
107    |        ^ associated item not found in `S`
108    |
109    = help: items from traits can only be used if the trait is in scope
110 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
111    |
112 LL | use assoc_const::B;
113    |
114
115 error[E0624]: associated constant `A` is private
116   --> $DIR/item-privacy.rs:101:14
117    |
118 LL |         const A: u8 = 0;
119    |         ----------- private associated constant defined here
120 ...
121 LL |     <dyn C>::A;
122    |              ^ private associated constant
123
124 error[E0038]: the trait `assoc_const::C` cannot be made into an object
125   --> $DIR/item-privacy.rs:101:6
126    |
127 LL |     <dyn C>::A;
128    |      ^^^^^ `assoc_const::C` cannot be made into an object
129    |
130 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>
131   --> $DIR/item-privacy.rs:25:15
132    |
133 LL |         const A: u8 = 0;
134    |               ^ ...because it contains this associated `const`
135 ...
136 LL |         const B: u8 = 0;
137    |               ^ ...because it contains this associated `const`
138 ...
139 LL |     pub trait C: A + B {
140    |               - this trait cannot be made into an object...
141 LL |         const C: u8 = 0;
142    |               ^ ...because it contains this associated `const`
143    = help: consider moving `C` to another trait
144    = help: consider moving `A` to another trait
145    = help: consider moving `B` to another trait
146
147 error[E0223]: ambiguous associated type
148   --> $DIR/item-privacy.rs:115:12
149    |
150 LL |     let _: S::A;
151    |            ^^^^
152    |
153 help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path
154    |
155 LL |     let _: <S as Example>::A;
156    |            ~~~~~~~~~~~~~~~~~
157
158 error[E0223]: ambiguous associated type
159   --> $DIR/item-privacy.rs:116:12
160    |
161 LL |     let _: S::B;
162    |            ^^^^ help: use the fully-qualified path: `<S as assoc_ty::B>::B`
163
164 error[E0223]: ambiguous associated type
165   --> $DIR/item-privacy.rs:117:12
166    |
167 LL |     let _: S::C;
168    |            ^^^^ help: use the fully-qualified path: `<S as assoc_ty::C>::C`
169
170 error[E0624]: associated type `A` is private
171   --> $DIR/item-privacy.rs:119:12
172    |
173 LL |         type A = u8;
174    |         ------ associated type defined here
175 ...
176 LL |     let _: T::A;
177    |            ^^^^ private associated type
178
179 error: associated type `A` is private
180   --> $DIR/item-privacy.rs:128:9
181    |
182 LL |         A = u8,
183    |         ^^^^^^ private associated type
184
185 error: aborting due to 15 previous errors
186
187 Some errors have detailed explanations: E0038, E0223, E0599, E0624.
188 For more information about an error, try `rustc --explain E0038`.