174
174
//! )
175
175
//! ```
176
176
177
- pub use StaticFields :: * ;
178
- pub use SubstructureFields :: * ;
177
+ pub ( crate ) use StaticFields :: * ;
178
+ pub ( crate ) use SubstructureFields :: * ;
179
179
180
180
use crate :: { deriving, errors} ;
181
181
use rustc_ast:: ptr:: P ;
@@ -195,9 +195,9 @@ use std::vec;
195
195
use thin_vec:: { thin_vec, ThinVec } ;
196
196
use ty:: { Bounds , Path , Ref , Self_ , Ty } ;
197
197
198
- pub mod ty;
198
+ pub ( crate ) mod ty;
199
199
200
- pub struct TraitDef < ' a > {
200
+ pub ( crate ) struct TraitDef < ' a > {
201
201
/// The span for the current #[derive(Foo)] header.
202
202
pub span : Span ,
203
203
@@ -224,7 +224,7 @@ pub struct TraitDef<'a> {
224
224
pub is_const : bool ,
225
225
}
226
226
227
- pub struct MethodDef < ' a > {
227
+ pub ( crate ) struct MethodDef < ' a > {
228
228
/// name of the method
229
229
pub name : Symbol ,
230
230
/// List of generics, e.g., `R: rand::Rng`
@@ -248,7 +248,7 @@ pub struct MethodDef<'a> {
248
248
249
249
/// How to handle fieldless enum variants.
250
250
#[ derive( PartialEq ) ]
251
- pub enum FieldlessVariantsStrategy {
251
+ pub ( crate ) enum FieldlessVariantsStrategy {
252
252
/// Combine fieldless variants into a single match arm.
253
253
/// This assumes that relevant information has been handled
254
254
/// by looking at the enum's discriminant.
@@ -263,7 +263,7 @@ pub enum FieldlessVariantsStrategy {
263
263
}
264
264
265
265
/// All the data about the data structure/method being derived upon.
266
- pub struct Substructure < ' a > {
266
+ pub ( crate ) struct Substructure < ' a > {
267
267
/// ident of self
268
268
pub type_ident : Ident ,
269
269
/// Verbatim access to any non-selflike arguments, i.e. arguments that
@@ -273,7 +273,7 @@ pub struct Substructure<'a> {
273
273
}
274
274
275
275
/// Summary of the relevant parts of a struct/enum field.
276
- pub struct FieldInfo {
276
+ pub ( crate ) struct FieldInfo {
277
277
pub span : Span ,
278
278
/// None for tuple structs/normal enum variants, Some for normal
279
279
/// structs/struct enum variants.
@@ -287,21 +287,21 @@ pub struct FieldInfo {
287
287
}
288
288
289
289
#[ derive( Copy , Clone ) ]
290
- pub enum IsTuple {
290
+ pub ( crate ) enum IsTuple {
291
291
No ,
292
292
Yes ,
293
293
}
294
294
295
295
/// Fields for a static method
296
- pub enum StaticFields {
296
+ pub ( crate ) enum StaticFields {
297
297
/// Tuple and unit structs/enum variants like this.
298
298
Unnamed ( Vec < Span > , IsTuple ) ,
299
299
/// Normal structs/struct variants.
300
300
Named ( Vec < ( Ident , Span ) > ) ,
301
301
}
302
302
303
303
/// A summary of the possible sets of fields.
304
- pub enum SubstructureFields < ' a > {
304
+ pub ( crate ) enum SubstructureFields < ' a > {
305
305
/// A non-static method where `Self` is a struct.
306
306
Struct ( & ' a ast:: VariantData , Vec < FieldInfo > ) ,
307
307
@@ -329,10 +329,10 @@ pub enum SubstructureFields<'a> {
329
329
330
330
/// Combine the values of all the fields together. The last argument is
331
331
/// all the fields of all the structures.
332
- pub type CombineSubstructureFunc < ' a > =
332
+ pub ( crate ) type CombineSubstructureFunc < ' a > =
333
333
Box < dyn FnMut ( & ExtCtxt < ' _ > , Span , & Substructure < ' _ > ) -> BlockOrExpr + ' a > ;
334
334
335
- pub fn combine_substructure (
335
+ pub ( crate ) fn combine_substructure (
336
336
f : CombineSubstructureFunc < ' _ > ,
337
337
) -> RefCell < CombineSubstructureFunc < ' _ > > {
338
338
RefCell :: new ( f)
@@ -349,7 +349,7 @@ struct TypeParameter {
349
349
/// avoiding the insertion of any unnecessary blocks.
350
350
///
351
351
/// The statements come before the expression.
352
- pub struct BlockOrExpr ( ThinVec < ast:: Stmt > , Option < P < Expr > > ) ;
352
+ pub ( crate ) struct BlockOrExpr ( ThinVec < ast:: Stmt > , Option < P < Expr > > ) ;
353
353
354
354
impl BlockOrExpr {
355
355
pub fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
@@ -1647,7 +1647,7 @@ impl<'a> TraitDef<'a> {
1647
1647
/// The function passed to `cs_fold` is called repeatedly with a value of this
1648
1648
/// type. It describes one part of the code generation. The result is always an
1649
1649
/// expression.
1650
- pub enum CsFold < ' a > {
1650
+ pub ( crate ) enum CsFold < ' a > {
1651
1651
/// The basic case: a field expression for one or more selflike args. E.g.
1652
1652
/// for `PartialEq::eq` this is something like `self.x == other.x`.
1653
1653
Single ( & ' a FieldInfo ) ,
@@ -1662,7 +1662,7 @@ pub enum CsFold<'a> {
1662
1662
1663
1663
/// Folds over fields, combining the expressions for each field in a sequence.
1664
1664
/// Statics may not be folded over.
1665
- pub fn cs_fold < F > (
1665
+ pub ( crate ) fn cs_fold < F > (
1666
1666
use_foldl : bool ,
1667
1667
cx : & ExtCtxt < ' _ > ,
1668
1668
trait_span : Span ,
0 commit comments