@@ -199,51 +199,51 @@ pub(crate) mod ty;
199
199
200
200
pub ( crate ) struct TraitDef < ' a > {
201
201
/// The span for the current #[derive(Foo)] header.
202
- pub span : Span ,
202
+ pub ( crate ) span : Span ,
203
203
204
204
/// Path of the trait, including any type parameters
205
- pub path : Path ,
205
+ pub ( crate ) path : Path ,
206
206
207
207
/// 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 ,
209
209
210
210
/// 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 ,
212
212
213
213
/// Additional bounds required of any type parameters of the type,
214
214
/// other than the current trait
215
- pub additional_bounds : Vec < Ty > ,
215
+ pub ( crate ) additional_bounds : Vec < Ty > ,
216
216
217
217
/// Can this trait be derived for unions?
218
- pub supports_unions : bool ,
218
+ pub ( crate ) supports_unions : bool ,
219
219
220
- pub methods : Vec < MethodDef < ' a > > ,
220
+ pub ( crate ) methods : Vec < MethodDef < ' a > > ,
221
221
222
- pub associated_types : Vec < ( Ident , Ty ) > ,
222
+ pub ( crate ) associated_types : Vec < ( Ident , Ty ) > ,
223
223
224
- pub is_const : bool ,
224
+ pub ( crate ) is_const : bool ,
225
225
}
226
226
227
227
pub ( crate ) struct MethodDef < ' a > {
228
228
/// name of the method
229
- pub name : Symbol ,
229
+ pub ( crate ) name : Symbol ,
230
230
/// List of generics, e.g., `R: rand::Rng`
231
- pub generics : Bounds ,
231
+ pub ( crate ) generics : Bounds ,
232
232
233
233
/// Is there is a `&self` argument? If not, it is a static function.
234
- pub explicit_self : bool ,
234
+ pub ( crate ) explicit_self : bool ,
235
235
236
236
/// Arguments other than the self argument.
237
- pub nonself_args : Vec < ( Ty , Symbol ) > ,
237
+ pub ( crate ) nonself_args : Vec < ( Ty , Symbol ) > ,
238
238
239
239
/// Returns type
240
- pub ret_ty : Ty ,
240
+ pub ( crate ) ret_ty : Ty ,
241
241
242
- pub attributes : ast:: AttrVec ,
242
+ pub ( crate ) attributes : ast:: AttrVec ,
243
243
244
- pub fieldless_variants_strategy : FieldlessVariantsStrategy ,
244
+ pub ( crate ) fieldless_variants_strategy : FieldlessVariantsStrategy ,
245
245
246
- pub combine_substructure : RefCell < CombineSubstructureFunc < ' a > > ,
246
+ pub ( crate ) combine_substructure : RefCell < CombineSubstructureFunc < ' a > > ,
247
247
}
248
248
249
249
/// How to handle fieldless enum variants.
@@ -265,25 +265,25 @@ pub(crate) enum FieldlessVariantsStrategy {
265
265
/// All the data about the data structure/method being derived upon.
266
266
pub ( crate ) struct Substructure < ' a > {
267
267
/// ident of self
268
- pub type_ident : Ident ,
268
+ pub ( crate ) type_ident : Ident ,
269
269
/// Verbatim access to any non-selflike arguments, i.e. arguments that
270
270
/// 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 > ,
273
273
}
274
274
275
275
/// Summary of the relevant parts of a struct/enum field.
276
276
pub ( crate ) struct FieldInfo {
277
- pub span : Span ,
277
+ pub ( crate ) span : Span ,
278
278
/// None for tuple structs/normal enum variants, Some for normal
279
279
/// structs/struct enum variants.
280
- pub name : Option < Ident > ,
280
+ pub ( crate ) name : Option < Ident > ,
281
281
/// The expression corresponding to this field of `self`
282
282
/// (specifically, a reference to it).
283
- pub self_expr : P < Expr > ,
283
+ pub ( crate ) self_expr : P < Expr > ,
284
284
/// The expressions corresponding to references to this field in
285
285
/// the other selflike arguments.
286
- pub other_selflike_exprs : Vec < P < Expr > > ,
286
+ pub ( crate ) other_selflike_exprs : Vec < P < Expr > > ,
287
287
}
288
288
289
289
#[ derive( Copy , Clone ) ]
@@ -352,15 +352,15 @@ struct TypeParameter {
352
352
pub ( crate ) struct BlockOrExpr ( ThinVec < ast:: Stmt > , Option < P < Expr > > ) ;
353
353
354
354
impl BlockOrExpr {
355
- pub fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
355
+ pub ( crate ) fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
356
356
BlockOrExpr ( stmts, None )
357
357
}
358
358
359
- pub fn new_expr ( expr : P < Expr > ) -> BlockOrExpr {
359
+ pub ( crate ) fn new_expr ( expr : P < Expr > ) -> BlockOrExpr {
360
360
BlockOrExpr ( ThinVec :: new ( ) , Some ( expr) )
361
361
}
362
362
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 {
364
364
BlockOrExpr ( stmts, expr)
365
365
}
366
366
@@ -452,7 +452,7 @@ fn find_type_parameters(
452
452
}
453
453
454
454
impl < ' a > TraitDef < ' a > {
455
- pub fn expand (
455
+ pub ( crate ) fn expand (
456
456
self ,
457
457
cx : & ExtCtxt < ' _ > ,
458
458
mitem : & ast:: MetaItem ,
@@ -462,7 +462,7 @@ impl<'a> TraitDef<'a> {
462
462
self . expand_ext ( cx, mitem, item, push, false ) ;
463
463
}
464
464
465
- pub fn expand_ext (
465
+ pub ( crate ) fn expand_ext (
466
466
self ,
467
467
cx : & ExtCtxt < ' _ > ,
468
468
mitem : & ast:: MetaItem ,
0 commit comments