1
+ use decoder:: Metadata ;
1
2
use table:: PerDefTable ;
2
3
3
4
use rustc:: hir;
@@ -22,7 +23,6 @@ use syntax_pos::{self, Span};
22
23
use std:: marker:: PhantomData ;
23
24
use std:: num:: NonZeroUsize ;
24
25
25
- crate use decoder:: Metadata ;
26
26
crate use encoder:: encode_metadata;
27
27
28
28
mod decoder;
@@ -110,13 +110,13 @@ crate struct Lazy<T, Meta = <T as LazyMeta>::Meta>
110
110
where T : ?Sized + LazyMeta < Meta = Meta > ,
111
111
Meta : ' static + Copy ,
112
112
{
113
- pub position : NonZeroUsize ,
114
- pub meta : Meta ,
113
+ position : NonZeroUsize ,
114
+ meta : Meta ,
115
115
_marker : PhantomData < T > ,
116
116
}
117
117
118
118
impl < T : ?Sized + LazyMeta > Lazy < T > {
119
- crate fn from_position_and_meta ( position : NonZeroUsize , meta : T :: Meta ) -> Lazy < T > {
119
+ fn from_position_and_meta ( position : NonZeroUsize , meta : T :: Meta ) -> Lazy < T > {
120
120
Lazy {
121
121
position,
122
122
meta,
@@ -126,13 +126,13 @@ impl<T: ?Sized + LazyMeta> Lazy<T> {
126
126
}
127
127
128
128
impl < T : Encodable > Lazy < T > {
129
- crate fn from_position ( position : NonZeroUsize ) -> Lazy < T > {
129
+ fn from_position ( position : NonZeroUsize ) -> Lazy < T > {
130
130
Lazy :: from_position_and_meta ( position, ( ) )
131
131
}
132
132
}
133
133
134
134
impl < T : Encodable > Lazy < [ T ] > {
135
- crate fn empty ( ) -> Lazy < [ T ] > {
135
+ fn empty ( ) -> Lazy < [ T ] > {
136
136
Lazy :: from_position_and_meta ( NonZeroUsize :: new ( 1 ) . unwrap ( ) , 0 )
137
137
}
138
138
}
@@ -149,7 +149,7 @@ impl<T: ?Sized + LazyMeta> rustc_serialize::UseSpecializedDecodable for Lazy<T>
149
149
150
150
/// Encoding / decoding state for `Lazy`.
151
151
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
152
- crate enum LazyState {
152
+ enum LazyState {
153
153
/// Outside of a metadata node.
154
154
NoNode ,
155
155
@@ -187,23 +187,23 @@ crate struct CrateRoot<'tcx> {
187
187
pub has_default_lib_allocator : bool ,
188
188
pub plugin_registrar_fn : Option < DefIndex > ,
189
189
pub proc_macro_decls_static : Option < DefIndex > ,
190
- pub proc_macro_stability : Option < attr:: Stability > ,
190
+ proc_macro_stability : Option < attr:: Stability > ,
191
191
192
192
pub crate_deps : Lazy < [ CrateDep ] > ,
193
- pub dylib_dependency_formats : Lazy < [ Option < LinkagePreference > ] > ,
194
- pub lib_features : Lazy < [ ( Symbol , Option < Symbol > ) ] > ,
195
- pub lang_items : Lazy < [ ( DefIndex , usize ) ] > ,
196
- pub lang_items_missing : Lazy < [ lang_items:: LangItem ] > ,
197
- pub diagnostic_items : Lazy < [ ( Symbol , DefIndex ) ] > ,
198
- pub native_libraries : Lazy < [ NativeLibrary ] > ,
199
- pub foreign_modules : Lazy < [ ForeignModule ] > ,
200
- pub source_map : Lazy < [ syntax_pos:: SourceFile ] > ,
193
+ dylib_dependency_formats : Lazy < [ Option < LinkagePreference > ] > ,
194
+ lib_features : Lazy < [ ( Symbol , Option < Symbol > ) ] > ,
195
+ lang_items : Lazy < [ ( DefIndex , usize ) ] > ,
196
+ lang_items_missing : Lazy < [ lang_items:: LangItem ] > ,
197
+ diagnostic_items : Lazy < [ ( Symbol , DefIndex ) ] > ,
198
+ native_libraries : Lazy < [ NativeLibrary ] > ,
199
+ foreign_modules : Lazy < [ ForeignModule ] > ,
200
+ source_map : Lazy < [ syntax_pos:: SourceFile ] > ,
201
201
pub def_path_table : Lazy < hir:: map:: definitions:: DefPathTable > ,
202
202
pub impls : Lazy < [ TraitImpls ] > ,
203
- pub exported_symbols : Lazy ! ( [ ( ExportedSymbol <' tcx>, SymbolExportLevel ) ] ) ,
203
+ exported_symbols : Lazy ! ( [ ( ExportedSymbol <' tcx>, SymbolExportLevel ) ] ) ,
204
204
pub interpret_alloc_index : Lazy < [ u32 ] > ,
205
205
206
- pub per_def : LazyPerDefTables < ' tcx > ,
206
+ per_def : LazyPerDefTables < ' tcx > ,
207
207
208
208
/// The DefIndex's of any proc macros delcared by
209
209
/// this crate
@@ -236,35 +236,33 @@ crate struct TraitImpls {
236
236
237
237
#[ derive( RustcEncodable , RustcDecodable ) ]
238
238
crate struct LazyPerDefTables < ' tcx > {
239
- pub kind : Lazy ! ( PerDefTable <Lazy !( EntryKind <' tcx>) >) ,
240
- pub visibility : Lazy ! ( PerDefTable <Lazy <ty:: Visibility >>) ,
241
- pub span : Lazy ! ( PerDefTable <Lazy <Span >>) ,
242
- pub attributes : Lazy ! ( PerDefTable <Lazy <[ ast:: Attribute ] >>) ,
243
- pub children : Lazy ! ( PerDefTable <Lazy <[ DefIndex ] >>) ,
244
- pub stability : Lazy ! ( PerDefTable <Lazy <attr:: Stability >>) ,
245
- pub deprecation : Lazy ! ( PerDefTable <Lazy <attr:: Deprecation >>) ,
246
-
247
- pub ty : Lazy ! ( PerDefTable <Lazy !( Ty <' tcx>) >) ,
248
- pub fn_sig : Lazy ! ( PerDefTable <Lazy !( ty:: PolyFnSig <' tcx>) >) ,
249
- pub impl_trait_ref : Lazy ! ( PerDefTable <Lazy !( ty:: TraitRef <' tcx>) >) ,
250
- pub inherent_impls : Lazy ! ( PerDefTable <Lazy <[ DefIndex ] >>) ,
251
- pub variances : Lazy ! ( PerDefTable <Lazy <[ ty:: Variance ] >>) ,
252
- pub generics : Lazy ! ( PerDefTable <Lazy <ty:: Generics >>) ,
253
- pub explicit_predicates : Lazy ! ( PerDefTable <Lazy !( ty:: GenericPredicates <' tcx>) >) ,
239
+ kind : Lazy ! ( PerDefTable <Lazy !( EntryKind <' tcx>) >) ,
240
+ visibility : Lazy ! ( PerDefTable <Lazy <ty:: Visibility >>) ,
241
+ span : Lazy ! ( PerDefTable <Lazy <Span >>) ,
242
+ attributes : Lazy ! ( PerDefTable <Lazy <[ ast:: Attribute ] >>) ,
243
+ children : Lazy ! ( PerDefTable <Lazy <[ DefIndex ] >>) ,
244
+ stability : Lazy ! ( PerDefTable <Lazy <attr:: Stability >>) ,
245
+ deprecation : Lazy ! ( PerDefTable <Lazy <attr:: Deprecation >>) ,
246
+ ty : Lazy ! ( PerDefTable <Lazy !( Ty <' tcx>) >) ,
247
+ fn_sig : Lazy ! ( PerDefTable <Lazy !( ty:: PolyFnSig <' tcx>) >) ,
248
+ impl_trait_ref : Lazy ! ( PerDefTable <Lazy !( ty:: TraitRef <' tcx>) >) ,
249
+ inherent_impls : Lazy ! ( PerDefTable <Lazy <[ DefIndex ] >>) ,
250
+ variances : Lazy ! ( PerDefTable <Lazy <[ ty:: Variance ] >>) ,
251
+ generics : Lazy ! ( PerDefTable <Lazy <ty:: Generics >>) ,
252
+ explicit_predicates : Lazy ! ( PerDefTable <Lazy !( ty:: GenericPredicates <' tcx>) >) ,
254
253
// FIXME(eddyb) this would ideally be `Lazy<[...]>` but `ty::Predicate`
255
254
// doesn't handle shorthands in its own (de)serialization impls,
256
255
// as it's an `enum` for which we want to derive (de)serialization,
257
256
// so the `ty::codec` APIs handle the whole `&'tcx [...]` at once.
258
257
// Also, as an optimization, a missing entry indicates an empty `&[]`.
259
- pub inferred_outlives : Lazy ! ( PerDefTable <Lazy !( & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] ) >) ,
260
- pub super_predicates : Lazy ! ( PerDefTable <Lazy !( ty:: GenericPredicates <' tcx>) >) ,
261
-
262
- pub mir : Lazy ! ( PerDefTable <Lazy !( mir:: Body <' tcx>) >) ,
263
- pub promoted_mir : Lazy ! ( PerDefTable <Lazy !( IndexVec <mir:: Promoted , mir:: Body <' tcx>>) >) ,
258
+ inferred_outlives : Lazy ! ( PerDefTable <Lazy !( & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] ) >) ,
259
+ super_predicates : Lazy ! ( PerDefTable <Lazy !( ty:: GenericPredicates <' tcx>) >) ,
260
+ mir : Lazy ! ( PerDefTable <Lazy !( mir:: Body <' tcx>) >) ,
261
+ promoted_mir : Lazy ! ( PerDefTable <Lazy !( IndexVec <mir:: Promoted , mir:: Body <' tcx>>) >) ,
264
262
}
265
263
266
264
#[ derive( Copy , Clone , RustcEncodable , RustcDecodable ) ]
267
- crate enum EntryKind < ' tcx > {
265
+ enum EntryKind < ' tcx > {
268
266
Const ( ConstQualif , Lazy < RenderedConst > ) ,
269
267
ImmStatic ,
270
268
MutStatic ,
@@ -299,18 +297,18 @@ crate enum EntryKind<'tcx> {
299
297
300
298
/// Additional data for EntryKind::Const and EntryKind::AssocConst
301
299
#[ derive( Clone , Copy , RustcEncodable , RustcDecodable ) ]
302
- crate struct ConstQualif {
303
- pub mir : u8 ,
300
+ struct ConstQualif {
301
+ mir : u8 ,
304
302
}
305
303
306
304
/// Contains a constant which has been rendered to a String.
307
305
/// Used by rustdoc.
308
306
#[ derive( RustcEncodable , RustcDecodable ) ]
309
- crate struct RenderedConst ( pub String ) ;
307
+ struct RenderedConst ( String ) ;
310
308
311
309
#[ derive( RustcEncodable , RustcDecodable ) ]
312
- crate struct ModData {
313
- pub reexports : Lazy < [ def:: Export < hir:: HirId > ] > ,
310
+ struct ModData {
311
+ reexports : Lazy < [ def:: Export < hir:: HirId > ] > ,
314
312
}
315
313
316
314
#[ derive( RustcEncodable , RustcDecodable ) ]
@@ -320,53 +318,53 @@ crate struct MacroDef {
320
318
}
321
319
322
320
#[ derive( RustcEncodable , RustcDecodable ) ]
323
- crate struct FnData {
324
- pub asyncness : hir:: IsAsync ,
325
- pub constness : hir:: Constness ,
326
- pub param_names : Lazy < [ ast:: Name ] > ,
321
+ struct FnData {
322
+ asyncness : hir:: IsAsync ,
323
+ constness : hir:: Constness ,
324
+ param_names : Lazy < [ ast:: Name ] > ,
327
325
}
328
326
329
327
#[ derive( RustcEncodable , RustcDecodable ) ]
330
- crate struct VariantData {
331
- pub ctor_kind : CtorKind ,
332
- pub discr : ty:: VariantDiscr ,
328
+ struct VariantData {
329
+ ctor_kind : CtorKind ,
330
+ discr : ty:: VariantDiscr ,
333
331
/// If this is unit or tuple-variant/struct, then this is the index of the ctor id.
334
- pub ctor : Option < DefIndex > ,
332
+ ctor : Option < DefIndex > ,
335
333
}
336
334
337
335
#[ derive( RustcEncodable , RustcDecodable ) ]
338
- crate struct TraitData {
339
- pub unsafety : hir:: Unsafety ,
340
- pub paren_sugar : bool ,
341
- pub has_auto_impl : bool ,
342
- pub is_marker : bool ,
336
+ struct TraitData {
337
+ unsafety : hir:: Unsafety ,
338
+ paren_sugar : bool ,
339
+ has_auto_impl : bool ,
340
+ is_marker : bool ,
343
341
}
344
342
345
343
#[ derive( RustcEncodable , RustcDecodable ) ]
346
- crate struct ImplData {
347
- pub polarity : ty:: ImplPolarity ,
348
- pub defaultness : hir:: Defaultness ,
349
- pub parent_impl : Option < DefId > ,
344
+ struct ImplData {
345
+ polarity : ty:: ImplPolarity ,
346
+ defaultness : hir:: Defaultness ,
347
+ parent_impl : Option < DefId > ,
350
348
351
349
/// This is `Some` only for impls of `CoerceUnsized`.
352
350
// FIXME(eddyb) perhaps compute this on the fly if cheap enough?
353
- pub coerce_unsized_info : Option < ty:: adjustment:: CoerceUnsizedInfo > ,
351
+ coerce_unsized_info : Option < ty:: adjustment:: CoerceUnsizedInfo > ,
354
352
}
355
353
356
354
357
355
/// Describes whether the container of an associated item
358
356
/// is a trait or an impl and whether, in a trait, it has
359
357
/// a default, or an in impl, whether it's marked "default".
360
358
#[ derive( Copy , Clone , RustcEncodable , RustcDecodable ) ]
361
- crate enum AssocContainer {
359
+ enum AssocContainer {
362
360
TraitRequired ,
363
361
TraitWithDefault ,
364
362
ImplDefault ,
365
363
ImplFinal ,
366
364
}
367
365
368
366
impl AssocContainer {
369
- crate fn with_def_id ( & self , def_id : DefId ) -> ty:: AssocItemContainer {
367
+ fn with_def_id ( & self , def_id : DefId ) -> ty:: AssocItemContainer {
370
368
match * self {
371
369
AssocContainer :: TraitRequired |
372
370
AssocContainer :: TraitWithDefault => ty:: TraitContainer ( def_id) ,
@@ -376,7 +374,7 @@ impl AssocContainer {
376
374
}
377
375
}
378
376
379
- crate fn defaultness ( & self ) -> hir:: Defaultness {
377
+ fn defaultness ( & self ) -> hir:: Defaultness {
380
378
match * self {
381
379
AssocContainer :: TraitRequired => hir:: Defaultness :: Default {
382
380
has_value : false ,
@@ -393,17 +391,17 @@ impl AssocContainer {
393
391
}
394
392
395
393
#[ derive( RustcEncodable , RustcDecodable ) ]
396
- crate struct MethodData {
397
- pub fn_data : FnData ,
398
- pub container : AssocContainer ,
399
- pub has_self : bool ,
394
+ struct MethodData {
395
+ fn_data : FnData ,
396
+ container : AssocContainer ,
397
+ has_self : bool ,
400
398
}
401
399
402
400
#[ derive( RustcEncodable , RustcDecodable ) ]
403
- crate struct GeneratorData < ' tcx > {
404
- pub layout : mir:: GeneratorLayout < ' tcx > ,
401
+ struct GeneratorData < ' tcx > {
402
+ layout : mir:: GeneratorLayout < ' tcx > ,
405
403
}
406
404
407
405
// Tags used for encoding Spans:
408
- crate const TAG_VALID_SPAN : u8 = 0 ;
409
- crate const TAG_INVALID_SPAN : u8 = 1 ;
406
+ const TAG_VALID_SPAN : u8 = 0 ;
407
+ const TAG_INVALID_SPAN : u8 = 1 ;
0 commit comments