Struct rustc_metadata::creader::CrateMetadataRef[−][src]

pub(crate) struct CrateMetadataRef<'a> {
    pub cdata: &'a CrateMetadata,
    pub cstore: &'a CStore,
}

A reference to CrateMetadata that can also give access to whole crate store when necessary.

Fields

cdata: &'a CrateMetadatacstore: &'a CStore

Implementations

impl<'a, 'tcx> CrateMetadataRef<'a>[src]

fn raw_proc_macro(&self, id: DefIndex) -> &ProcMacro[src]

fn try_item_ident(
    &self,
    item_index: DefIndex,
    sess: &Session
) -> Result<Ident, String>
[src]

fn item_ident(&self, item_index: DefIndex, sess: &Session) -> Ident[src]

fn maybe_kind(&self, item_id: DefIndex) -> Option<EntryKind>[src]

fn kind(&self, item_id: DefIndex) -> EntryKind[src]

fn def_kind(&self, item_id: DefIndex) -> DefKind[src]

fn get_span(&self, index: DefIndex, sess: &Session) -> Span[src]

fn load_proc_macro(&self, id: DefIndex, sess: &Session) -> SyntaxExtension[src]

fn get_trait_def(&self, item_id: DefIndex, sess: &Session) -> TraitDef[src]

fn get_variant(
    &self,
    kind: &EntryKind,
    index: DefIndex,
    parent_did: DefId,
    sess: &Session
) -> VariantDef
[src]

fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> &'tcx AdtDef[src]

fn get_explicit_predicates(
    &self,
    item_id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
[src]

fn get_inferred_outlives(
    &self,
    item_id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_super_predicates(
    &self,
    item_id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
[src]

fn get_explicit_item_bounds(
    &self,
    item_id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_generics(&self, item_id: DefIndex, sess: &Session) -> Generics[src]

fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx>[src]

fn get_stability(&self, id: DefIndex) -> Option<Stability>[src]

fn get_const_stability(&self, id: DefIndex) -> Option<ConstStability>[src]

fn get_deprecation(&self, id: DefIndex) -> Option<Deprecation>[src]

fn get_visibility(&self, id: DefIndex) -> Visibility[src]

fn get_impl_data(&self, id: DefIndex) -> ImplData[src]

fn get_parent_impl(&self, id: DefIndex) -> Option<DefId>[src]

fn get_impl_polarity(&self, id: DefIndex) -> ImplPolarity[src]

fn get_impl_defaultness(&self, id: DefIndex) -> Defaultness[src]

fn get_coerce_unsized_info(&self, id: DefIndex) -> Option<CoerceUnsizedInfo>[src]

fn get_impl_trait(
    &self,
    id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> Option<TraitRef<'tcx>>
[src]

fn get_expn_that_defined(&self, id: DefIndex, sess: &Session) -> ExpnId[src]

fn get_lib_features(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(Symbol, Option<Symbol>)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Iterates over all the stability attributes in the given crate.

fn get_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Iterates over the language items in the given crate.

fn get_diagnostic_items(&self) -> FxHashMap<Symbol, DefId>[src]

Iterates over the diagnostic items in the given crate.

fn each_child_of_item<F>(&self, id: DefIndex, callback: F, sess: &Session) where
    F: FnMut(Export<HirId>), 
[src]

Iterates over each child of the given item.

fn is_ctfe_mir_available(&self, id: DefIndex) -> bool[src]

fn is_item_mir_available(&self, id: DefIndex) -> bool[src]

fn module_expansion(&self, id: DefIndex, sess: &Session) -> ExpnId[src]

fn get_optimized_mir(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> Body<'tcx>[src]

fn get_mir_for_ctfe(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> Body<'tcx>[src]

fn get_mir_abstract_const(
    &self,
    tcx: TyCtxt<'tcx>,
    id: DefIndex
) -> Result<Option<&'tcx [Node<'tcx>]>, ErrorReported>
[src]

fn get_unused_generic_params(&self, id: DefIndex) -> FiniteBitSet<u32>[src]

fn get_promoted_mir(
    &self,
    tcx: TyCtxt<'tcx>,
    id: DefIndex
) -> IndexVec<Promoted, Body<'tcx>>
[src]

fn mir_const_qualif(&self, id: DefIndex) -> ConstQualifs[src]

fn get_associated_item(&self, id: DefIndex, sess: &Session) -> AssocItem[src]

fn get_item_variances(
    &'a self,
    id: DefIndex
) -> impl Iterator<Item = Variance> + 'a
[src]

fn get_ctor_kind(&self, node_id: DefIndex) -> CtorKind[src]

fn get_ctor_def_id(&self, node_id: DefIndex) -> Option<DefId>[src]

fn get_item_attrs(
    &'a self,
    node_id: DefIndex,
    sess: &'a Session
) -> impl Iterator<Item = Attribute> + 'a
[src]

fn get_struct_field_names(
    &self,
    id: DefIndex,
    sess: &Session
) -> Vec<Spanned<Symbol>>
[src]

fn get_inherent_implementations_for_type(
    &self,
    tcx: TyCtxt<'tcx>,
    id: DefIndex
) -> &'tcx [DefId]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_implementations_for_trait(
    &self,
    tcx: TyCtxt<'tcx>,
    filter: Option<DefId>
) -> &'tcx [(DefId, Option<SimplifiedType>)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_trait_of_item(&self, id: DefIndex) -> Option<DefId>[src]

fn get_native_libraries(&self, sess: &Session) -> Vec<NativeLib>[src]

fn get_foreign_modules(
    &self,
    tcx: TyCtxt<'tcx>
) -> Lrc<FxHashMap<DefId, ForeignModule>>
[src]

fn get_dylib_dependency_formats(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_missing_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [LangItem]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_fn_param_names(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> &'tcx [Ident]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn exported_symbols(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn get_rendered_const(&self, id: DefIndex) -> String[src]

fn get_macro(&self, id: DefIndex, sess: &Session) -> MacroDef[src]

fn is_const_fn_raw(&self, id: DefIndex) -> bool[src]

fn asyncness(&self, id: DefIndex) -> IsAsync[src]

fn is_foreign_item(&self, id: DefIndex) -> bool[src]

fn static_mutability(&self, id: DefIndex) -> Option<Mutability>[src]

fn generator_kind(&self, id: DefIndex) -> Option<GeneratorKind>[src]

fn fn_sig(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> PolyFnSig<'tcx>[src]

fn def_key(&self, index: DefIndex) -> DefKey[src]

fn def_path_hash_to_def_id(
    &self,
    krate: CrateNum,
    index_guess: u32,
    hash: DefPathHash
) -> Option<DefId>
[src]

Finds the corresponding DefId for the provided DefPathHash, if it exists. This is used by incremental compilation to map a serialized DefPathHash to its DefId in the current session. Normally, only one ‘main’ crate will change between incremental compilation sessions: all dependencies will be completely unchanged. In this case, we can avoid decoding every DefPathHash in the crate, since the DefIndex from the previous session will still be valid. If our ‘guess’ is wrong (the DefIndex no longer exists, or has a different DefPathHash, then we need to decode all DefPathHashes to determine the correct mapping).

fn def_path(&self, id: DefIndex) -> DefPath[src]

fn def_path_hash_unlocked(
    &self,
    index: DefIndex,
    def_path_hashes: &mut FxHashMap<DefIndex, DefPathHash>
) -> DefPathHash
[src]

fn def_path_hash(&self, index: DefIndex) -> DefPathHash[src]

fn imported_source_files(&self, sess: &Session) -> &'a [ImportedSourceFile]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

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>

pub(crate) fn dependencies(&self) -> LockGuard<'_, Vec<CrateNum>>[src]

pub(crate) fn add_dependency(&self, cnum: CrateNum)[src]

pub(crate) fn update_extern_crate(&self, new_extern_crate: ExternCrate) -> bool[src]

pub(crate) fn source(&self) -> &CrateSource[src]

pub(crate) fn dep_kind(&self) -> CrateDepKind[src]

pub(crate) fn update_dep_kind(
    &self,
    f: impl FnOnce(CrateDepKind) -> CrateDepKind
)
[src]

pub(crate) fn panic_strategy(&self) -> PanicStrategy[src]

pub(crate) fn needs_panic_runtime(&self) -> bool[src]

pub(crate) fn is_panic_runtime(&self) -> bool[src]

pub(crate) fn is_profiler_runtime(&self) -> bool[src]

pub(crate) fn needs_allocator(&self) -> bool[src]

pub(crate) fn has_global_allocator(&self) -> bool[src]

pub(crate) fn has_default_lib_allocator(&self) -> bool[src]

pub(crate) fn is_proc_macro_crate(&self) -> bool[src]

pub(crate) fn name(&self) -> Symbol[src]

pub(crate) fn disambiguator(&self) -> CrateDisambiguator[src]

pub(crate) fn hash(&self) -> Svh[src]

fn num_def_ids(&self) -> usize[src]

fn local_def_id(&self, index: DefIndex) -> DefId[src]

fn reverse_translate_def_id(&self, did: DefId) -> Option<DefId>[src]

Trait Implementations

impl<'a> Clone for CrateMetadataRef<'a>[src]

impl<'a> Copy for CrateMetadataRef<'a>[src]

impl Deref for CrateMetadataRef<'_>[src]

type Target = CrateMetadata

The resulting type after dereferencing.

impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a CrateMetadataRef<'a>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.