@@ -199,51 +199,51 @@ pub(crate) mod ty;
199199
200200pub ( crate ) struct TraitDef < ' a > {
201201 /// The span for the current #[derive(Foo)] header.
202- pub span : Span ,
202+ pub ( crate ) span : Span ,
203203
204204 /// Path of the trait, including any type parameters
205- pub path : Path ,
205+ pub ( crate ) path : Path ,
206206
207207 /// Whether to skip adding the current trait as a bound to the type parameters of the type.
208- pub skip_path_as_bound : bool ,
208+ pub ( crate ) skip_path_as_bound : bool ,
209209
210210 /// Whether `Copy` is needed as an additional bound on type parameters in a packed struct.
211- pub needs_copy_as_bound_if_packed : bool ,
211+ pub ( crate ) needs_copy_as_bound_if_packed : bool ,
212212
213213 /// Additional bounds required of any type parameters of the type,
214214 /// other than the current trait
215- pub additional_bounds : Vec < Ty > ,
215+ pub ( crate ) additional_bounds : Vec < Ty > ,
216216
217217 /// Can this trait be derived for unions?
218- pub supports_unions : bool ,
218+ pub ( crate ) supports_unions : bool ,
219219
220- pub methods : Vec < MethodDef < ' a > > ,
220+ pub ( crate ) methods : Vec < MethodDef < ' a > > ,
221221
222- pub associated_types : Vec < ( Ident , Ty ) > ,
222+ pub ( crate ) associated_types : Vec < ( Ident , Ty ) > ,
223223
224- pub is_const : bool ,
224+ pub ( crate ) is_const : bool ,
225225}
226226
227227pub ( crate ) struct MethodDef < ' a > {
228228 /// name of the method
229- pub name : Symbol ,
229+ pub ( crate ) name : Symbol ,
230230 /// List of generics, e.g., `R: rand::Rng`
231- pub generics : Bounds ,
231+ pub ( crate ) generics : Bounds ,
232232
233233 /// Is there is a `&self` argument? If not, it is a static function.
234- pub explicit_self : bool ,
234+ pub ( crate ) explicit_self : bool ,
235235
236236 /// Arguments other than the self argument.
237- pub nonself_args : Vec < ( Ty , Symbol ) > ,
237+ pub ( crate ) nonself_args : Vec < ( Ty , Symbol ) > ,
238238
239239 /// Returns type
240- pub ret_ty : Ty ,
240+ pub ( crate ) ret_ty : Ty ,
241241
242- pub attributes : ast:: AttrVec ,
242+ pub ( crate ) attributes : ast:: AttrVec ,
243243
244- pub fieldless_variants_strategy : FieldlessVariantsStrategy ,
244+ pub ( crate ) fieldless_variants_strategy : FieldlessVariantsStrategy ,
245245
246- pub combine_substructure : RefCell < CombineSubstructureFunc < ' a > > ,
246+ pub ( crate ) combine_substructure : RefCell < CombineSubstructureFunc < ' a > > ,
247247}
248248
249249/// How to handle fieldless enum variants.
@@ -265,25 +265,25 @@ pub(crate) enum FieldlessVariantsStrategy {
265265/// All the data about the data structure/method being derived upon.
266266pub ( crate ) struct Substructure < ' a > {
267267 /// ident of self
268- pub type_ident : Ident ,
268+ pub ( crate ) type_ident : Ident ,
269269 /// Verbatim access to any non-selflike arguments, i.e. arguments that
270270 /// don't have type `&Self`.
271- pub nonselflike_args : & ' a [ P < Expr > ] ,
272- pub fields : & ' a SubstructureFields < ' a > ,
271+ pub ( crate ) nonselflike_args : & ' a [ P < Expr > ] ,
272+ pub ( crate ) fields : & ' a SubstructureFields < ' a > ,
273273}
274274
275275/// Summary of the relevant parts of a struct/enum field.
276276pub ( crate ) struct FieldInfo {
277- pub span : Span ,
277+ pub ( crate ) span : Span ,
278278 /// None for tuple structs/normal enum variants, Some for normal
279279 /// structs/struct enum variants.
280- pub name : Option < Ident > ,
280+ pub ( crate ) name : Option < Ident > ,
281281 /// The expression corresponding to this field of `self`
282282 /// (specifically, a reference to it).
283- pub self_expr : P < Expr > ,
283+ pub ( crate ) self_expr : P < Expr > ,
284284 /// The expressions corresponding to references to this field in
285285 /// the other selflike arguments.
286- pub other_selflike_exprs : Vec < P < Expr > > ,
286+ pub ( crate ) other_selflike_exprs : Vec < P < Expr > > ,
287287}
288288
289289#[ derive( Copy , Clone ) ]
@@ -352,15 +352,15 @@ struct TypeParameter {
352352pub ( crate ) struct BlockOrExpr ( ThinVec < ast:: Stmt > , Option < P < Expr > > ) ;
353353
354354impl BlockOrExpr {
355- pub fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
355+ pub ( crate ) fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
356356 BlockOrExpr ( stmts, None )
357357 }
358358
359- pub fn new_expr ( expr : P < Expr > ) -> BlockOrExpr {
359+ pub ( crate ) fn new_expr ( expr : P < Expr > ) -> BlockOrExpr {
360360 BlockOrExpr ( ThinVec :: new ( ) , Some ( expr) )
361361 }
362362
363- pub fn new_mixed ( stmts : ThinVec < ast:: Stmt > , expr : Option < P < Expr > > ) -> BlockOrExpr {
363+ pub ( crate ) fn new_mixed ( stmts : ThinVec < ast:: Stmt > , expr : Option < P < Expr > > ) -> BlockOrExpr {
364364 BlockOrExpr ( stmts, expr)
365365 }
366366
@@ -452,7 +452,7 @@ fn find_type_parameters(
452452}
453453
454454impl < ' a > TraitDef < ' a > {
455- pub fn expand (
455+ pub ( crate ) fn expand (
456456 self ,
457457 cx : & ExtCtxt < ' _ > ,
458458 mitem : & ast:: MetaItem ,
@@ -462,7 +462,7 @@ impl<'a> TraitDef<'a> {
462462 self . expand_ext ( cx, mitem, item, push, false ) ;
463463 }
464464
465- pub fn expand_ext (
465+ pub ( crate ) fn expand_ext (
466466 self ,
467467 cx : & ExtCtxt < ' _ > ,
468468 mitem : & ast:: MetaItem ,
0 commit comments