Struct rustc_metadata::cstore::CrateMetadata
[−]
[src]
pub struct CrateMetadata { pub name: Symbol, pub extern_crate: Cell<Option<ExternCrate>>, pub blob: MetadataBlob, pub cnum_map: RefCell<CrateNumMap>, pub cnum: CrateNum, pub codemap_import_info: RefCell<Vec<ImportedFileMap>>, pub root: CrateRoot, pub def_path_table: DefPathTable, pub exported_symbols: FxHashSet<DefIndex>, pub dep_kind: Cell<DepKind>, pub source: CrateSource, pub proc_macros: Option<Vec<(Name, Rc<SyntaxExtension>)>>, pub dllimport_foreign_items: FxHashSet<DefIndex>, }
rustc_private
)Fields
name: Symbol
rustc_private
)extern_crate: Cell<Option<ExternCrate>>
rustc_private
)Information about the extern crate that caused this crate to
be loaded. If this is None
, then the crate was injected
(e.g., by the allocator)
blob: MetadataBlob
rustc_private
)cnum_map: RefCell<CrateNumMap>
rustc_private
)cnum: CrateNum
rustc_private
)codemap_import_info: RefCell<Vec<ImportedFileMap>>
rustc_private
)root: CrateRoot
rustc_private
)def_path_table: DefPathTable
rustc_private
)For each public item in this crate, we encode a key. When the
crate is loaded, we read all the keys and put them in this
hashmap, which gives the reverse mapping. This allows us to
quickly retrace a DefPath
, which is needed for incremental
compilation support.
exported_symbols: FxHashSet<DefIndex>
rustc_private
)dep_kind: Cell<DepKind>
rustc_private
)source: CrateSource
rustc_private
)proc_macros: Option<Vec<(Name, Rc<SyntaxExtension>)>>
rustc_private
)dllimport_foreign_items: FxHashSet<DefIndex>
rustc_private
)Methods
impl<'a, 'tcx> CrateMetadata
[src]
fn get_def(&self, index: DefIndex) -> Option<Def>
rustc_private
)fn get_span(&self, index: DefIndex, sess: &Session) -> Span
rustc_private
)fn get_trait_def(&self,
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> TraitDef
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> TraitDef
rustc_private
)fn get_adt_def(&self,
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> &'tcx AdtDef
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> &'tcx AdtDef
rustc_private
)fn get_predicates(&self,
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> GenericPredicates<'tcx>
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> GenericPredicates<'tcx>
rustc_private
)fn get_super_predicates(&self,
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> GenericPredicates<'tcx>
item_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> GenericPredicates<'tcx>
rustc_private
)fn get_generics(&self, item_id: DefIndex) -> Generics
rustc_private
)fn get_type(&self, id: DefIndex, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx>
rustc_private
)fn get_stability(&self, id: DefIndex) -> Option<Stability>
rustc_private
)fn get_deprecation(&self, id: DefIndex) -> Option<Deprecation>
rustc_private
)fn get_visibility(&self, id: DefIndex) -> Visibility
rustc_private
)fn get_parent_impl(&self, id: DefIndex) -> Option<DefId>
rustc_private
)fn get_impl_polarity(&self, id: DefIndex) -> ImplPolarity
rustc_private
)fn get_custom_coerce_unsized_kind(&self,
id: DefIndex)
-> Option<CustomCoerceUnsized>
id: DefIndex)
-> Option<CustomCoerceUnsized>
rustc_private
)fn get_impl_trait(&self,
id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> Option<TraitRef<'tcx>>
id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> Option<TraitRef<'tcx>>
rustc_private
)fn get_lang_items(&self) -> Vec<(DefIndex, usize)>
rustc_private
)Iterates over the language items in the given crate.
fn each_child_of_item<F>(&self, id: DefIndex, callback: F) where F: FnMut(Export)
rustc_private
)Iterates over each child of the given item.
fn maybe_get_item_body(&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: DefIndex)
-> Option<&'tcx Body>
tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: DefIndex)
-> Option<&'tcx Body>
rustc_private
)fn item_body_tables(&self,
id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> &'tcx TypeckTables<'tcx>
id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> &'tcx TypeckTables<'tcx>
rustc_private
)fn item_body_nested_bodies(&self, id: DefIndex) -> BTreeMap<BodyId, Body>
rustc_private
)fn const_is_rvalue_promotable_to_static(&self, id: DefIndex) -> bool
rustc_private
)fn is_item_mir_available(&self, id: DefIndex) -> bool
rustc_private
)fn maybe_get_item_mir(&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: DefIndex)
-> Option<Mir<'tcx>>
tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: DefIndex)
-> Option<Mir<'tcx>>
rustc_private
)fn mir_const_qualif(&self, id: DefIndex) -> u8
rustc_private
)fn get_associated_item(&self, id: DefIndex) -> AssociatedItem
rustc_private
)fn get_item_variances(&self, id: DefIndex) -> Vec<Variance>
rustc_private
)fn get_ctor_kind(&self, node_id: DefIndex) -> CtorKind
rustc_private
)fn get_struct_ctor_def_id(&self, node_id: DefIndex) -> Option<DefId>
rustc_private
)fn get_item_attrs(&self, node_id: DefIndex) -> Vec<Attribute>
rustc_private
)fn get_struct_field_names(&self, id: DefIndex) -> Vec<Name>
rustc_private
)fn get_inherent_implementations_for_type(&self, id: DefIndex) -> Vec<DefId>
rustc_private
)fn get_implementations_for_trait(&self,
filter: Option<DefId>,
result: &mut Vec<DefId>)
filter: Option<DefId>,
result: &mut Vec<DefId>)
rustc_private
)fn get_trait_of_item(&self, id: DefIndex) -> Option<DefId>
rustc_private
)fn get_native_libraries(&self) -> Vec<NativeLibrary>
rustc_private
)fn get_dylib_dependency_formats(&self) -> Vec<(CrateNum, LinkagePreference)>
rustc_private
)fn get_missing_lang_items(&self) -> Vec<LangItem>
rustc_private
)fn get_fn_arg_names(&self, id: DefIndex) -> Vec<Name>
rustc_private
)fn get_exported_symbols(&self) -> Vec<DefId>
rustc_private
)fn get_macro(&self, id: DefIndex) -> (Name, MacroDef)
rustc_private
)fn is_const_fn(&self, id: DefIndex) -> bool
rustc_private
)fn is_foreign_item(&self, id: DefIndex) -> bool
rustc_private
)fn is_dllimport_foreign_item(&self, id: DefIndex) -> bool
rustc_private
)fn is_default_impl(&self, impl_id: DefIndex) -> bool
rustc_private
)fn closure_kind(&self, closure_id: DefIndex) -> ClosureKind
rustc_private
)fn closure_ty(&self,
closure_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> PolyFnSig<'tcx>
closure_id: DefIndex,
tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> PolyFnSig<'tcx>
rustc_private
)fn def_key(&self, index: DefIndex) -> DefKey
rustc_private
)fn def_path(&self, id: DefIndex) -> DefPath
rustc_private
)fn imported_filemaps(&'a self,
local_codemap: &CodeMap)
-> Ref<'a, Vec<ImportedFileMap>>
local_codemap: &CodeMap)
-> Ref<'a, Vec<ImportedFileMap>>
rustc_private
)Imports the codemap from an external crate into the codemap of the crate currently being compiled (the "local crate").
The import algorithm works analogous to how AST items are inlined from an
external crate's metadata:
For every FileMap in the external codemap an 'inline' copy is created in the
local codemap. The correspondence relation between external and local
FileMaps is recorded in the ImportedFileMap
objects returned from this
function. When an item from an external crate is later inlined into this
crate, this correspondence information is used to translate the span
information of the inlined item so that it refers the correct positions in
the local codemap (see <decoder::DecodeContext as SpecializedDecoder<Span>>
).
The import algorithm in the function below will reuse FileMaps already existing in the local codemap. For example, even if the FileMap of some source file of libstd gets imported many times, there will only ever be one FileMap object for the corresponding file in the local codemap.
Note that imported FileMaps do not actually contain the source code of the file they represent, just information about length, line breaks, and multibyte characters. This information is enough to generate valid debuginfo for items inlined from other crates.
impl CrateMetadata
[src]
fn name(&self) -> Symbol
rustc_private
)fn hash(&self) -> Svh
rustc_private
)fn disambiguator(&self) -> Symbol
rustc_private
)fn is_staged_api(&self) -> bool
rustc_private
)fn is_allocator(&self) -> bool
rustc_private
)fn needs_allocator(&self) -> bool
rustc_private
)fn is_panic_runtime(&self) -> bool
rustc_private
)fn needs_panic_runtime(&self) -> bool
rustc_private
)fn is_compiler_builtins(&self) -> bool
rustc_private
)fn is_sanitizer_runtime(&self) -> bool
rustc_private
)fn is_no_builtins(&self) -> bool
rustc_private
)fn panic_strategy(&self) -> PanicStrategy
rustc_private
)