diff options
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta/mod.rs')
-rw-r--r-- | compiler/rustc_metadata/src/rmeta/mod.rs | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index 66bdecc30..748b3afec 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -16,6 +16,7 @@ use rustc_index::{bit_set::FiniteBitSet, vec::IndexVec}; use rustc_middle::metadata::ModChild; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo}; +use rustc_middle::middle::resolve_lifetime::ObjectLifetimeDefault; use rustc_middle::mir; use rustc_middle::ty::fast_reject::SimplifiedType; use rustc_middle::ty::query::Providers; @@ -249,7 +250,7 @@ pub(crate) struct CrateRoot { def_path_hash_map: LazyValue<DefPathHashMapRef<'static>>, - source_map: LazyArray<rustc_span::SourceFile>, + source_map: LazyTable<u32, LazyValue<rustc_span::SourceFile>>, compiler_builtins: bool, needs_allocator: bool, @@ -333,16 +334,16 @@ macro_rules! define_tables { } define_tables! { - kind: Table<DefIndex, LazyValue<EntryKind>>, attributes: Table<DefIndex, LazyArray<ast::Attribute>>, children: Table<DefIndex, LazyArray<DefIndex>>, opt_def_kind: Table<DefIndex, DefKind>, - visibility: Table<DefIndex, LazyValue<ty::Visibility>>, + visibility: Table<DefIndex, LazyValue<ty::Visibility<DefIndex>>>, def_span: Table<DefIndex, LazyValue<Span>>, def_ident_span: Table<DefIndex, LazyValue<Span>>, lookup_stability: Table<DefIndex, LazyValue<attr::Stability>>, lookup_const_stability: Table<DefIndex, LazyValue<attr::ConstStability>>, + lookup_default_body_stability: Table<DefIndex, LazyValue<attr::DefaultBodyStability>>, lookup_deprecation_entry: Table<DefIndex, LazyValue<attr::Deprecation>>, // As an optimization, a missing entry indicates an empty `&[]`. explicit_item_bounds: Table<DefIndex, LazyArray<(ty::Predicate<'static>, Span)>>, @@ -357,6 +358,7 @@ define_tables! { codegen_fn_attrs: Table<DefIndex, LazyValue<CodegenFnAttrs>>, impl_trait_ref: Table<DefIndex, LazyValue<ty::TraitRef<'static>>>, const_param_default: Table<DefIndex, LazyValue<rustc_middle::ty::Const<'static>>>, + object_lifetime_default: Table<DefIndex, LazyValue<ObjectLifetimeDefault>>, optimized_mir: Table<DefIndex, LazyValue<mir::Body<'static>>>, mir_for_ctfe: Table<DefIndex, LazyValue<mir::Body<'static>>>, promoted_mir: Table<DefIndex, LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>, @@ -390,39 +392,13 @@ define_tables! { proc_macro_quoted_spans: Table<usize, LazyValue<Span>>, generator_diagnostic_data: Table<DefIndex, LazyValue<GeneratorDiagnosticData<'static>>>, may_have_doc_links: Table<DefIndex, ()>, -} - -#[derive(Copy, Clone, MetadataEncodable, MetadataDecodable)] -enum EntryKind { - AnonConst, - Const, - Static, - ForeignStatic, - ForeignMod, - ForeignType, - GlobalAsm, - Type, - TypeParam, - ConstParam, - OpaqueTy, - Enum, - Field, - Variant(LazyValue<VariantData>), - Struct(LazyValue<VariantData>), - Union(LazyValue<VariantData>), - Fn, - ForeignFn, - Mod(LazyArray<ModChild>), - MacroDef(LazyValue<ast::MacArgs>, /*macro_rules*/ bool), - ProcMacro(MacroKind), - Closure, - Generator, - Trait, - Impl, - AssocFn { container: ty::AssocItemContainer, has_self: bool }, - AssocType(ty::AssocItemContainer), - AssocConst(ty::AssocItemContainer), - TraitAlias, + variant_data: Table<DefIndex, LazyValue<VariantData>>, + assoc_container: Table<DefIndex, ty::AssocItemContainer>, + // Slot is full when macro is macro_rules. + macro_rules: Table<DefIndex, ()>, + macro_definition: Table<DefIndex, LazyValue<ast::MacArgs>>, + proc_macro: Table<DefIndex, MacroKind>, + module_reexports: Table<DefIndex, LazyArray<ModChild>>, } #[derive(TyEncodable, TyDecodable)] @@ -444,6 +420,11 @@ const TAG_VALID_SPAN_LOCAL: u8 = 0; const TAG_VALID_SPAN_FOREIGN: u8 = 1; const TAG_PARTIAL_SPAN: u8 = 2; +// Tags for encoding Symbol's +const SYMBOL_STR: u8 = 0; +const SYMBOL_OFFSET: u8 = 1; +const SYMBOL_PREINTERNED: u8 = 2; + pub fn provide(providers: &mut Providers) { encoder::provide(providers); decoder::provide(providers); @@ -451,7 +432,6 @@ pub fn provide(providers: &mut Providers) { trivially_parameterized_over_tcx! { VariantData, - EntryKind, RawDefId, TraitImpls, IncoherentImpls, |