1+ use decoder:: Metadata ;
12use table:: PerDefTable ;
23
34use rustc:: hir;
@@ -22,7 +23,6 @@ use syntax_pos::{self, Span};
2223use std:: marker:: PhantomData ;
2324use std:: num:: NonZeroUsize ;
2425
25- crate use decoder:: Metadata ;
2626crate use encoder:: encode_metadata;
2727
2828mod decoder;
@@ -110,13 +110,13 @@ crate struct Lazy<T, Meta = <T as LazyMeta>::Meta>
110110 where T : ?Sized + LazyMeta < Meta = Meta > ,
111111 Meta : ' static + Copy ,
112112{
113- pub position : NonZeroUsize ,
114- pub meta : Meta ,
113+ position : NonZeroUsize ,
114+ meta : Meta ,
115115 _marker : PhantomData < T > ,
116116}
117117
118118impl < 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 > {
120120 Lazy {
121121 position,
122122 meta,
@@ -126,13 +126,13 @@ impl<T: ?Sized + LazyMeta> Lazy<T> {
126126}
127127
128128impl < T : Encodable > Lazy < T > {
129- crate fn from_position ( position : NonZeroUsize ) -> Lazy < T > {
129+ fn from_position ( position : NonZeroUsize ) -> Lazy < T > {
130130 Lazy :: from_position_and_meta ( position, ( ) )
131131 }
132132}
133133
134134impl < T : Encodable > Lazy < [ T ] > {
135- crate fn empty ( ) -> Lazy < [ T ] > {
135+ fn empty ( ) -> Lazy < [ T ] > {
136136 Lazy :: from_position_and_meta ( NonZeroUsize :: new ( 1 ) . unwrap ( ) , 0 )
137137 }
138138}
@@ -149,7 +149,7 @@ impl<T: ?Sized + LazyMeta> rustc_serialize::UseSpecializedDecodable for Lazy<T>
149149
150150/// Encoding / decoding state for `Lazy`.
151151#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
152- crate enum LazyState {
152+ enum LazyState {
153153 /// Outside of a metadata node.
154154 NoNode ,
155155
@@ -187,23 +187,23 @@ crate struct CrateRoot<'tcx> {
187187 pub has_default_lib_allocator : bool ,
188188 pub plugin_registrar_fn : Option < DefIndex > ,
189189 pub proc_macro_decls_static : Option < DefIndex > ,
190- pub proc_macro_stability : Option < attr:: Stability > ,
190+ proc_macro_stability : Option < attr:: Stability > ,
191191
192192 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 ] > ,
201201 pub def_path_table : Lazy < hir:: map:: definitions:: DefPathTable > ,
202202 pub impls : Lazy < [ TraitImpls ] > ,
203- pub exported_symbols : Lazy ! ( [ ( ExportedSymbol <' tcx>, SymbolExportLevel ) ] ) ,
203+ exported_symbols : Lazy ! ( [ ( ExportedSymbol <' tcx>, SymbolExportLevel ) ] ) ,
204204 pub interpret_alloc_index : Lazy < [ u32 ] > ,
205205
206- pub per_def : LazyPerDefTables < ' tcx > ,
206+ per_def : LazyPerDefTables < ' tcx > ,
207207
208208 /// The DefIndex's of any proc macros delcared by
209209 /// this crate
@@ -236,35 +236,33 @@ crate struct TraitImpls {
236236
237237#[ derive( RustcEncodable , RustcDecodable ) ]
238238crate 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>) >) ,
254253 // FIXME(eddyb) this would ideally be `Lazy<[...]>` but `ty::Predicate`
255254 // doesn't handle shorthands in its own (de)serialization impls,
256255 // as it's an `enum` for which we want to derive (de)serialization,
257256 // so the `ty::codec` APIs handle the whole `&'tcx [...]` at once.
258257 // 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>>) >) ,
264262}
265263
266264#[ derive( Copy , Clone , RustcEncodable , RustcDecodable ) ]
267- crate enum EntryKind < ' tcx > {
265+ enum EntryKind < ' tcx > {
268266 Const ( ConstQualif , Lazy < RenderedConst > ) ,
269267 ImmStatic ,
270268 MutStatic ,
@@ -299,18 +297,18 @@ crate enum EntryKind<'tcx> {
299297
300298/// Additional data for EntryKind::Const and EntryKind::AssocConst
301299#[ derive( Clone , Copy , RustcEncodable , RustcDecodable ) ]
302- crate struct ConstQualif {
303- pub mir : u8 ,
300+ struct ConstQualif {
301+ mir : u8 ,
304302}
305303
306304/// Contains a constant which has been rendered to a String.
307305/// Used by rustdoc.
308306#[ derive( RustcEncodable , RustcDecodable ) ]
309- crate struct RenderedConst ( pub String ) ;
307+ struct RenderedConst ( String ) ;
310308
311309#[ 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 > ] > ,
314312}
315313
316314#[ derive( RustcEncodable , RustcDecodable ) ]
@@ -320,53 +318,53 @@ crate struct MacroDef {
320318}
321319
322320#[ 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 ] > ,
327325}
328326
329327#[ 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 ,
333331 /// 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 > ,
335333}
336334
337335#[ 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 ,
343341}
344342
345343#[ 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 > ,
350348
351349 /// This is `Some` only for impls of `CoerceUnsized`.
352350 // 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 > ,
354352}
355353
356354
357355/// Describes whether the container of an associated item
358356/// is a trait or an impl and whether, in a trait, it has
359357/// a default, or an in impl, whether it's marked "default".
360358#[ derive( Copy , Clone , RustcEncodable , RustcDecodable ) ]
361- crate enum AssocContainer {
359+ enum AssocContainer {
362360 TraitRequired ,
363361 TraitWithDefault ,
364362 ImplDefault ,
365363 ImplFinal ,
366364}
367365
368366impl AssocContainer {
369- crate fn with_def_id ( & self , def_id : DefId ) -> ty:: AssocItemContainer {
367+ fn with_def_id ( & self , def_id : DefId ) -> ty:: AssocItemContainer {
370368 match * self {
371369 AssocContainer :: TraitRequired |
372370 AssocContainer :: TraitWithDefault => ty:: TraitContainer ( def_id) ,
@@ -376,7 +374,7 @@ impl AssocContainer {
376374 }
377375 }
378376
379- crate fn defaultness ( & self ) -> hir:: Defaultness {
377+ fn defaultness ( & self ) -> hir:: Defaultness {
380378 match * self {
381379 AssocContainer :: TraitRequired => hir:: Defaultness :: Default {
382380 has_value : false ,
@@ -393,17 +391,17 @@ impl AssocContainer {
393391}
394392
395393#[ 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 ,
400398}
401399
402400#[ derive( RustcEncodable , RustcDecodable ) ]
403- crate struct GeneratorData < ' tcx > {
404- pub layout : mir:: GeneratorLayout < ' tcx > ,
401+ struct GeneratorData < ' tcx > {
402+ layout : mir:: GeneratorLayout < ' tcx > ,
405403}
406404
407405// 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