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

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]

pub(in rmeta::decoder) fn is_proc_macro(
    &self,
    id: DefIndex
) -> bool
[src]

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

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

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

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

pub(in rmeta::decoder) fn def_kind(
    &self,
    index: DefIndex
) -> DefKind
[src]

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

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

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

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

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

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

pub(in rmeta::decoder) fn get_inferred_outlives(
    &self,
    item_id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
[src]

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

pub(in rmeta::decoder) fn get_explicit_item_bounds(
    &self,
    item_id: DefIndex,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

pub(in rmeta::decoder) fn get_lib_features(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(Symbol, Option<Symbol>)]
[src]

Iterates over all the stability attributes in the given crate.

pub(in rmeta::decoder) fn get_lang_items(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(DefId, usize)]
[src]

Iterates over the language items in the given crate.

pub(in rmeta::decoder) fn get_diagnostic_items(
    &self
) -> FxHashMap<Symbol, DefId>
[src]

Iterates over the diagnostic items in the given crate.

pub(in rmeta::decoder) 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

pub(in rmeta::decoder) fn get_inherent_implementations_for_type(
    &self,
    tcx: TyCtxt<'tcx>,
    id: DefIndex
) -> &'tcx [DefId]
[src]

pub(in rmeta::decoder) fn get_implementations_for_trait(
    &self,
    tcx: TyCtxt<'tcx>,
    filter: Option<DefId>
) -> &'tcx [(DefId, Option<SimplifiedType>)]
[src]

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

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

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

pub(in rmeta::decoder) fn get_dylib_dependency_formats(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)]
[src]

pub(in rmeta::decoder) fn get_missing_lang_items(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [LangItem]
[src]

pub(in rmeta::decoder) fn get_fn_param_names(
    &self,
    tcx: TyCtxt<'tcx>,
    id: DefIndex
) -> &'tcx [Ident]
[src]

pub(in rmeta::decoder) fn exported_symbols(
    &self,
    tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)]
[src]

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

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

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

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

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

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

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

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

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

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

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

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

pub(in rmeta::decoder) fn all_def_path_hashes_and_def_ids(
    &self
) -> Vec<(DefPathHash, DefId)>
[src]

pub(in rmeta::decoder) fn get_crate_dep_node_index(
    &self,
    tcx: TyCtxt<'tcx>
) -> DepNodeIndex
[src]

Get the DepNodeIndex corresponding this crate. The result of this method is cached in the dep_node_index field.

pub(in rmeta::decoder) fn imported_source_files(
    &self,
    sess: &Session
) -> &'a [ImportedSourceFile]
[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]

pub(in rmeta::decoder) fn num_def_ids(
    &self
) -> usize
[src]

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

pub(in rmeta::decoder) 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.