@@ -185,9 +185,9 @@ enum LazyState {
185185 Previous ( NonZeroUsize ) ,
186186}
187187
188- type SyntaxContextTable = LazyTable < u32 , LazyValue < SyntaxContextData > > ;
189- type ExpnDataTable = LazyTable < ExpnIndex , LazyValue < ExpnData > > ;
190- type ExpnHashTable = LazyTable < ExpnIndex , LazyValue < ExpnHash > > ;
188+ type SyntaxContextTable = LazyTable < u32 , Option < LazyValue < SyntaxContextData > > > ;
189+ type ExpnDataTable = LazyTable < ExpnIndex , Option < LazyValue < ExpnData > > > ;
190+ type ExpnHashTable = LazyTable < ExpnIndex , Option < LazyValue < ExpnHash > > > ;
191191
192192#[ derive( MetadataEncodable , MetadataDecodable ) ]
193193pub ( crate ) struct ProcMacroData {
@@ -253,7 +253,7 @@ pub(crate) struct CrateRoot {
253253
254254 def_path_hash_map : LazyValue < DefPathHashMapRef < ' static > > ,
255255
256- source_map : LazyTable < u32 , LazyValue < rustc_span:: SourceFile > > ,
256+ source_map : LazyTable < u32 , Option < LazyValue < rustc_span:: SourceFile > > > ,
257257
258258 compiler_builtins : bool ,
259259 needs_allocator : bool ,
@@ -315,31 +315,43 @@ pub(crate) struct IncoherentImpls {
315315
316316/// Define `LazyTables` and `TableBuilders` at the same time.
317317macro_rules! define_tables {
318- ( $( $name: ident: Table <$IDX: ty, $T: ty>) ,+ $( , ) ?) => {
318+ (
319+ - nullable: $( $name1: ident: Table <$IDX1: ty, $T1: ty>, ) +
320+ - optional: $( $name2: ident: Table <$IDX2: ty, $T2: ty>, ) +
321+ ) => {
319322 #[ derive( MetadataEncodable , MetadataDecodable ) ]
320323 pub ( crate ) struct LazyTables {
321- $( $name: LazyTable <$IDX, $T>) ,+
324+ $( $name1: LazyTable <$IDX1, $T1>, ) +
325+ $( $name2: LazyTable <$IDX2, Option <$T2>>, ) +
322326 }
323327
324328 #[ derive( Default ) ]
325329 struct TableBuilders {
326- $( $name: TableBuilder <$IDX, $T>) ,+
330+ $( $name1: TableBuilder <$IDX1, $T1>, ) +
331+ $( $name2: TableBuilder <$IDX2, Option <$T2>>, ) +
327332 }
328333
329334 impl TableBuilders {
330335 fn encode( & self , buf: & mut FileEncoder ) -> LazyTables {
331336 LazyTables {
332- $( $name: self . $name. encode( buf) ) ,+
337+ $( $name1: self . $name1. encode( buf) , ) +
338+ $( $name2: self . $name2. encode( buf) , ) +
333339 }
334340 }
335341 }
336342 }
337343}
338344
339345define_tables ! {
346+ - nullable:
347+ is_intrinsic: Table <DefIndex , bool >,
348+ is_macro_rules: Table <DefIndex , bool >,
349+ is_type_alias_impl_trait: Table <DefIndex , bool >,
350+ attr_flags: Table <DefIndex , AttrFlags >,
351+
352+ - optional:
340353 attributes: Table <DefIndex , LazyArray <ast:: Attribute >>,
341354 children: Table <DefIndex , LazyArray <DefIndex >>,
342-
343355 opt_def_kind: Table <DefIndex , DefKind >,
344356 visibility: Table <DefIndex , LazyValue <ty:: Visibility <DefIndex >>>,
345357 def_span: Table <DefIndex , LazyValue <Span >>,
@@ -370,7 +382,6 @@ define_tables! {
370382 impl_parent: Table <DefIndex , RawDefId >,
371383 impl_polarity: Table <DefIndex , ty:: ImplPolarity >,
372384 constness: Table <DefIndex , hir:: Constness >,
373- is_intrinsic: Table <DefIndex , ( ) >,
374385 impl_defaultness: Table <DefIndex , hir:: Defaultness >,
375386 // FIXME(eddyb) perhaps compute this on the fly if cheap enough?
376387 coerce_unsized_info: Table <DefIndex , LazyValue <ty:: adjustment:: CoerceUnsizedInfo >>,
@@ -380,7 +391,6 @@ define_tables! {
380391 fn_arg_names: Table <DefIndex , LazyArray <Ident >>,
381392 generator_kind: Table <DefIndex , LazyValue <hir:: GeneratorKind >>,
382393 trait_def: Table <DefIndex , LazyValue <ty:: TraitDef >>,
383-
384394 trait_item_def_id: Table <DefIndex , RawDefId >,
385395 inherent_impls: Table <DefIndex , LazyArray <DefIndex >>,
386396 expn_that_defined: Table <DefIndex , LazyValue <ExpnId >>,
@@ -395,18 +405,12 @@ define_tables! {
395405 def_path_hashes: Table <DefIndex , DefPathHash >,
396406 proc_macro_quoted_spans: Table <usize , LazyValue <Span >>,
397407 generator_diagnostic_data: Table <DefIndex , LazyValue <GeneratorDiagnosticData <' static >>>,
398- attr_flags: Table <DefIndex , AttrFlags >,
399408 variant_data: Table <DefIndex , LazyValue <VariantData >>,
400409 assoc_container: Table <DefIndex , ty:: AssocItemContainer >,
401- // Slot is full when macro is macro_rules.
402- macro_rules: Table <DefIndex , ( ) >,
403410 macro_definition: Table <DefIndex , LazyValue <ast:: DelimArgs >>,
404411 proc_macro: Table <DefIndex , MacroKind >,
405412 module_reexports: Table <DefIndex , LazyArray <ModChild >>,
406413 deduced_param_attrs: Table <DefIndex , LazyArray <DeducedParamAttrs >>,
407- // Slot is full when opaque is TAIT.
408- is_type_alias_impl_trait: Table <DefIndex , ( ) >,
409-
410414 trait_impl_trait_tys: Table <DefIndex , LazyValue <FxHashMap <DefId , Ty <' static >>>>,
411415}
412416
@@ -419,6 +423,7 @@ struct VariantData {
419423}
420424
421425bitflags:: bitflags! {
426+ #[ derive( Default ) ]
422427 pub struct AttrFlags : u8 {
423428 const MAY_HAVE_DOC_LINKS = 1 << 0 ;
424429 const IS_DOC_HIDDEN = 1 << 1 ;
0 commit comments