@@ -185,9 +185,9 @@ enum LazyState {
185
185
Previous ( NonZeroUsize ) ,
186
186
}
187
187
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 > > > ;
191
191
192
192
#[ derive( MetadataEncodable , MetadataDecodable ) ]
193
193
pub ( crate ) struct ProcMacroData {
@@ -253,7 +253,7 @@ pub(crate) struct CrateRoot {
253
253
254
254
def_path_hash_map : LazyValue < DefPathHashMapRef < ' static > > ,
255
255
256
- source_map : LazyTable < u32 , LazyValue < rustc_span:: SourceFile > > ,
256
+ source_map : LazyTable < u32 , Option < LazyValue < rustc_span:: SourceFile > > > ,
257
257
258
258
compiler_builtins : bool ,
259
259
needs_allocator : bool ,
@@ -315,31 +315,43 @@ pub(crate) struct IncoherentImpls {
315
315
316
316
/// Define `LazyTables` and `TableBuilders` at the same time.
317
317
macro_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
+ ) => {
319
322
#[ derive( MetadataEncodable , MetadataDecodable ) ]
320
323
pub ( crate ) struct LazyTables {
321
- $( $name: LazyTable <$IDX, $T>) ,+
324
+ $( $name1: LazyTable <$IDX1, $T1>, ) +
325
+ $( $name2: LazyTable <$IDX2, Option <$T2>>, ) +
322
326
}
323
327
324
328
#[ derive( Default ) ]
325
329
struct TableBuilders {
326
- $( $name: TableBuilder <$IDX, $T>) ,+
330
+ $( $name1: TableBuilder <$IDX1, $T1>, ) +
331
+ $( $name2: TableBuilder <$IDX2, Option <$T2>>, ) +
327
332
}
328
333
329
334
impl TableBuilders {
330
335
fn encode( & self , buf: & mut FileEncoder ) -> LazyTables {
331
336
LazyTables {
332
- $( $name: self . $name. encode( buf) ) ,+
337
+ $( $name1: self . $name1. encode( buf) , ) +
338
+ $( $name2: self . $name2. encode( buf) , ) +
333
339
}
334
340
}
335
341
}
336
342
}
337
343
}
338
344
339
345
define_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:
340
353
attributes: Table <DefIndex , LazyArray <ast:: Attribute >>,
341
354
children: Table <DefIndex , LazyArray <DefIndex >>,
342
-
343
355
opt_def_kind: Table <DefIndex , DefKind >,
344
356
visibility: Table <DefIndex , LazyValue <ty:: Visibility <DefIndex >>>,
345
357
def_span: Table <DefIndex , LazyValue <Span >>,
@@ -370,7 +382,6 @@ define_tables! {
370
382
impl_parent: Table <DefIndex , RawDefId >,
371
383
impl_polarity: Table <DefIndex , ty:: ImplPolarity >,
372
384
constness: Table <DefIndex , hir:: Constness >,
373
- is_intrinsic: Table <DefIndex , ( ) >,
374
385
impl_defaultness: Table <DefIndex , hir:: Defaultness >,
375
386
// FIXME(eddyb) perhaps compute this on the fly if cheap enough?
376
387
coerce_unsized_info: Table <DefIndex , LazyValue <ty:: adjustment:: CoerceUnsizedInfo >>,
@@ -380,7 +391,6 @@ define_tables! {
380
391
fn_arg_names: Table <DefIndex , LazyArray <Ident >>,
381
392
generator_kind: Table <DefIndex , LazyValue <hir:: GeneratorKind >>,
382
393
trait_def: Table <DefIndex , LazyValue <ty:: TraitDef >>,
383
-
384
394
trait_item_def_id: Table <DefIndex , RawDefId >,
385
395
inherent_impls: Table <DefIndex , LazyArray <DefIndex >>,
386
396
expn_that_defined: Table <DefIndex , LazyValue <ExpnId >>,
@@ -395,18 +405,12 @@ define_tables! {
395
405
def_path_hashes: Table <DefIndex , DefPathHash >,
396
406
proc_macro_quoted_spans: Table <usize , LazyValue <Span >>,
397
407
generator_diagnostic_data: Table <DefIndex , LazyValue <GeneratorDiagnosticData <' static >>>,
398
- attr_flags: Table <DefIndex , AttrFlags >,
399
408
variant_data: Table <DefIndex , LazyValue <VariantData >>,
400
409
assoc_container: Table <DefIndex , ty:: AssocItemContainer >,
401
- // Slot is full when macro is macro_rules.
402
- macro_rules: Table <DefIndex , ( ) >,
403
410
macro_definition: Table <DefIndex , LazyValue <ast:: DelimArgs >>,
404
411
proc_macro: Table <DefIndex , MacroKind >,
405
412
module_reexports: Table <DefIndex , LazyArray <ModChild >>,
406
413
deduced_param_attrs: Table <DefIndex , LazyArray <DeducedParamAttrs >>,
407
- // Slot is full when opaque is TAIT.
408
- is_type_alias_impl_trait: Table <DefIndex , ( ) >,
409
-
410
414
trait_impl_trait_tys: Table <DefIndex , LazyValue <FxHashMap <DefId , Ty <' static >>>>,
411
415
}
412
416
@@ -419,6 +423,7 @@ struct VariantData {
419
423
}
420
424
421
425
bitflags:: bitflags! {
426
+ #[ derive( Default ) ]
422
427
pub struct AttrFlags : u8 {
423
428
const MAY_HAVE_DOC_LINKS = 1 << 0 ;
424
429
const IS_DOC_HIDDEN = 1 << 1 ;
0 commit comments