Struct rustc_metadata::creader::CrateMetadataRef [−][src]
pub(crate) struct CrateMetadataRef<'a> {
pub cdata: &'a CrateMetadata,
pub cstore: &'a CStore,
}
Expand description
A reference to CrateMetadata
that can also give access to whole crate store when necessary.
Fields
cdata: &'a CrateMetadata
cstore: &'a CStore
Implementations
fn get_variant(
&self,
kind: &EntryKind,
index: DefIndex,
parent_did: DefId,
sess: &Session
) -> VariantDef
fn get_explicit_predicates(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
fn get_inferred_outlives(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
fn get_super_predicates(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
fn get_explicit_item_bounds(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
Iterates over all the stability attributes in the given crate.
Iterates over the language items in the given crate.
Iterates over the diagnostic items in the given crate.
Iterates over each child of the given item.
fn get_thir_abstract_const(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> Result<Option<&'tcx [Node<'tcx>]>, ErrorReported>
fn get_item_attrs(
&'a self,
node_id: DefIndex,
sess: &'a Session
) -> impl Iterator<Item = Attribute> + 'a
fn get_implementations_for_trait(
&self,
tcx: TyCtxt<'tcx>,
filter: Option<DefId>
) -> &'tcx [(DefId, Option<SimplifiedType>)]
fn get_dylib_dependency_formats(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)]
fn exported_symbols(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)]
fn def_path_hash_unlocked(
&self,
index: DefIndex,
def_path_hashes: &mut FxHashMap<DefIndex, DefPathHash>
) -> DefPathHash
Imports the source_map from an external crate into the source_map 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 SourceFile in the external source_map an ‘inline’ copy is created in the
local source_map. The correspondence relation between external and local
SourceFiles is recorded in the ImportedSourceFile
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 source_map (see <decoder::DecodeContext as SpecializedDecoder<Span>>
).
The import algorithm in the function below will reuse SourceFiles already existing in the local source_map. For example, even if the SourceFile of some source file of libstd gets imported many times, there will only ever be one SourceFile object for the corresponding file in the local source_map.
Note that imported SourceFiles 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.
Proc macro crates don’t currently export spans, so this function does not have to work for them.
Methods from Deref<Target = CrateMetadata>
Trait Implementations
type Target = CrateMetadata
type Target = CrateMetadata
The resulting type after dereferencing.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for CrateMetadataRef<'a>
impl<'a> !Send for CrateMetadataRef<'a>
impl<'a> !Sync for CrateMetadataRef<'a>
impl<'a> Unpin for CrateMetadataRef<'a>
impl<'a> !UnwindSafe for CrateMetadataRef<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes