[−][src]Struct rustc_metadata::creader::CrateMetadataRef
A reference to CrateMetadata that can also give access to whole crate store when necessary.
Fields
cdata: &'a CrateMetadatacstore: &'a CStoreImplementations
impl<'a, 'tcx> CrateMetadataRef<'a>[src]
pub(in rmeta::decoder) fn is_proc_macro(
&self,
id: DefIndex
) -> bool[src]
&self,
id: DefIndex
) -> bool
pub(in rmeta::decoder) fn maybe_kind(
&self,
item_id: DefIndex
) -> Option<EntryKind>[src]
&self,
item_id: DefIndex
) -> Option<EntryKind>
pub(in rmeta::decoder) fn kind(
&self,
item_id: DefIndex
) -> EntryKind[src]
&self,
item_id: DefIndex
) -> EntryKind
pub(in rmeta::decoder) fn raw_proc_macro(
&self,
id: DefIndex
) -> &ProcMacro[src]
&self,
id: DefIndex
) -> &ProcMacro
pub(in rmeta::decoder) fn item_ident(
&self,
item_index: DefIndex,
sess: &Session
) -> Ident[src]
&self,
item_index: DefIndex,
sess: &Session
) -> Ident
pub(in rmeta::decoder) fn def_kind(
&self,
index: DefIndex
) -> DefKind[src]
&self,
index: DefIndex
) -> DefKind
pub(in rmeta::decoder) fn get_span(
&self,
index: DefIndex,
sess: &Session
) -> Span[src]
&self,
index: DefIndex,
sess: &Session
) -> Span
pub(in rmeta::decoder) fn load_proc_macro(
&self,
id: DefIndex,
sess: &Session
) -> SyntaxExtension[src]
&self,
id: DefIndex,
sess: &Session
) -> SyntaxExtension
pub(in rmeta::decoder) fn get_trait_def(
&self,
item_id: DefIndex,
sess: &Session
) -> TraitDef[src]
&self,
item_id: DefIndex,
sess: &Session
) -> TraitDef
pub(in rmeta::decoder) fn get_variant(
&self,
kind: &EntryKind,
index: DefIndex,
parent_did: DefId,
sess: &Session
) -> VariantDef[src]
&self,
kind: &EntryKind,
index: DefIndex,
parent_did: DefId,
sess: &Session
) -> VariantDef
pub(in rmeta::decoder) fn get_adt_def(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx AdtDef[src]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx AdtDef
pub(in rmeta::decoder) fn get_explicit_predicates(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>[src]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
pub(in rmeta::decoder) fn get_inferred_outlives(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)][src]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
pub(in rmeta::decoder) fn get_super_predicates(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>[src]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
pub(in rmeta::decoder) fn get_explicit_item_bounds(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)][src]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
pub(in rmeta::decoder) fn get_generics(
&self,
item_id: DefIndex,
sess: &Session
) -> Generics[src]
&self,
item_id: DefIndex,
sess: &Session
) -> Generics
pub(in rmeta::decoder) fn get_type(
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> Ty<'tcx>[src]
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> Ty<'tcx>
pub(in rmeta::decoder) fn get_stability(
&self,
id: DefIndex
) -> Option<Stability>[src]
&self,
id: DefIndex
) -> Option<Stability>
pub(in rmeta::decoder) fn get_const_stability(
&self,
id: DefIndex
) -> Option<ConstStability>[src]
&self,
id: DefIndex
) -> Option<ConstStability>
pub(in rmeta::decoder) fn get_deprecation(
&self,
id: DefIndex
) -> Option<Deprecation>[src]
&self,
id: DefIndex
) -> Option<Deprecation>
pub(in rmeta::decoder) fn get_visibility(
&self,
id: DefIndex
) -> Visibility[src]
&self,
id: DefIndex
) -> Visibility
pub(in rmeta::decoder) fn get_impl_data(
&self,
id: DefIndex
) -> ImplData[src]
&self,
id: DefIndex
) -> ImplData
pub(in rmeta::decoder) fn get_parent_impl(
&self,
id: DefIndex
) -> Option<DefId>[src]
&self,
id: DefIndex
) -> Option<DefId>
pub(in rmeta::decoder) fn get_impl_polarity(
&self,
id: DefIndex
) -> ImplPolarity[src]
&self,
id: DefIndex
) -> ImplPolarity
pub(in rmeta::decoder) fn get_impl_defaultness(
&self,
id: DefIndex
) -> Defaultness[src]
&self,
id: DefIndex
) -> Defaultness
pub(in rmeta::decoder) fn get_coerce_unsized_info(
&self,
id: DefIndex
) -> Option<CoerceUnsizedInfo>[src]
&self,
id: DefIndex
) -> Option<CoerceUnsizedInfo>
pub(in rmeta::decoder) fn get_impl_trait(
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> Option<TraitRef<'tcx>>[src]
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> Option<TraitRef<'tcx>>
pub(in rmeta::decoder) fn get_expn_that_defined(
&self,
id: DefIndex,
sess: &Session
) -> ExpnId[src]
&self,
id: DefIndex,
sess: &Session
) -> ExpnId
pub(in rmeta::decoder) fn get_lib_features(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Symbol, Option<Symbol>)][src]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Symbol, Option<Symbol>)]
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]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(DefId, usize)]
Iterates over the language items in the given crate.
pub(in rmeta::decoder) fn get_diagnostic_items(
&self
) -> FxHashMap<Symbol, DefId>[src]
&self
) -> FxHashMap<Symbol, DefId>
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]
&self,
id: DefIndex,
callback: F,
sess: &Session
) where
F: FnMut(Export<HirId>),
Iterates over each child of the given item.
pub(in rmeta::decoder) fn is_item_mir_available(
&self,
id: DefIndex
) -> bool[src]
&self,
id: DefIndex
) -> bool
pub(in rmeta::decoder) fn module_expansion(
&self,
id: DefIndex,
sess: &Session
) -> ExpnId[src]
&self,
id: DefIndex,
sess: &Session
) -> ExpnId
pub(in rmeta::decoder) fn get_optimized_mir(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> Body<'tcx>[src]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> Body<'tcx>
pub(in rmeta::decoder) fn get_mir_abstract_const(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> Result<Option<&'tcx [Node<'tcx>]>, ErrorReported>[src]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> Result<Option<&'tcx [Node<'tcx>]>, ErrorReported>
pub(in rmeta::decoder) fn get_unused_generic_params(
&self,
id: DefIndex
) -> FiniteBitSet<u32>[src]
&self,
id: DefIndex
) -> FiniteBitSet<u32>
pub(in rmeta::decoder) fn get_promoted_mir(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> IndexVec<Promoted, Body<'tcx>>[src]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> IndexVec<Promoted, Body<'tcx>>
pub(in rmeta::decoder) fn mir_const_qualif(
&self,
id: DefIndex
) -> ConstQualifs[src]
&self,
id: DefIndex
) -> ConstQualifs
pub(in rmeta::decoder) fn get_associated_item(
&self,
id: DefIndex,
sess: &Session
) -> AssocItem[src]
&self,
id: DefIndex,
sess: &Session
) -> AssocItem
pub(in rmeta::decoder) fn get_item_variances(
&'a self,
id: DefIndex
) -> impl Iterator<Item = Variance> + 'a[src]
&'a self,
id: DefIndex
) -> impl Iterator<Item = Variance> + 'a
pub(in rmeta::decoder) fn get_ctor_kind(
&self,
node_id: DefIndex
) -> CtorKind[src]
&self,
node_id: DefIndex
) -> CtorKind
pub(in rmeta::decoder) fn get_ctor_def_id(
&self,
node_id: DefIndex
) -> Option<DefId>[src]
&self,
node_id: DefIndex
) -> Option<DefId>
pub(in rmeta::decoder) fn get_item_attrs(
&'a self,
node_id: DefIndex,
sess: &'a Session
) -> impl Iterator<Item = Attribute> + 'a[src]
&'a self,
node_id: DefIndex,
sess: &'a Session
) -> impl Iterator<Item = Attribute> + 'a
pub(in rmeta::decoder) fn get_struct_field_names(
&self,
id: DefIndex,
sess: &Session
) -> Vec<Spanned<Symbol>>[src]
&self,
id: DefIndex,
sess: &Session
) -> Vec<Spanned<Symbol>>
pub(in rmeta::decoder) fn get_inherent_implementations_for_type(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> &'tcx [DefId][src]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> &'tcx [DefId]
pub(in rmeta::decoder) fn get_implementations_for_trait(
&self,
tcx: TyCtxt<'tcx>,
filter: Option<DefId>
) -> &'tcx [(DefId, Option<SimplifiedType>)][src]
&self,
tcx: TyCtxt<'tcx>,
filter: Option<DefId>
) -> &'tcx [(DefId, Option<SimplifiedType>)]
pub(in rmeta::decoder) fn get_trait_of_item(
&self,
id: DefIndex
) -> Option<DefId>[src]
&self,
id: DefIndex
) -> Option<DefId>
pub(in rmeta::decoder) fn get_native_libraries(
&self,
sess: &Session
) -> Vec<NativeLib>[src]
&self,
sess: &Session
) -> Vec<NativeLib>
pub(in rmeta::decoder) fn get_foreign_modules(
&self,
tcx: TyCtxt<'tcx>
) -> Lrc<FxHashMap<DefId, ForeignModule>>[src]
&self,
tcx: TyCtxt<'tcx>
) -> Lrc<FxHashMap<DefId, ForeignModule>>
pub(in rmeta::decoder) fn get_dylib_dependency_formats(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)][src]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)]
pub(in rmeta::decoder) fn get_missing_lang_items(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [LangItem][src]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [LangItem]
pub(in rmeta::decoder) fn get_fn_param_names(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> &'tcx [Ident][src]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> &'tcx [Ident]
pub(in rmeta::decoder) fn exported_symbols(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)][src]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)]
pub(in rmeta::decoder) fn get_rendered_const(
&self,
id: DefIndex
) -> String[src]
&self,
id: DefIndex
) -> String
pub(in rmeta::decoder) fn get_macro(
&self,
id: DefIndex,
sess: &Session
) -> MacroDef[src]
&self,
id: DefIndex,
sess: &Session
) -> MacroDef
pub(in rmeta::decoder) fn is_const_fn_raw(
&self,
id: DefIndex
) -> bool[src]
&self,
id: DefIndex
) -> bool
pub(in rmeta::decoder) fn asyncness(
&self,
id: DefIndex
) -> IsAsync[src]
&self,
id: DefIndex
) -> IsAsync
pub(in rmeta::decoder) fn is_foreign_item(
&self,
id: DefIndex
) -> bool[src]
&self,
id: DefIndex
) -> bool
pub(in rmeta::decoder) fn static_mutability(
&self,
id: DefIndex
) -> Option<Mutability>[src]
&self,
id: DefIndex
) -> Option<Mutability>
pub(in rmeta::decoder) fn generator_kind(
&self,
id: DefIndex
) -> Option<GeneratorKind>[src]
&self,
id: DefIndex
) -> Option<GeneratorKind>
pub(in rmeta::decoder) fn fn_sig(
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> PolyFnSig<'tcx>[src]
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> PolyFnSig<'tcx>
pub(in rmeta::decoder) fn def_key(
&self,
index: DefIndex
) -> DefKey[src]
&self,
index: DefIndex
) -> DefKey
pub(in rmeta::decoder) fn def_path(
&self,
id: DefIndex
) -> DefPath[src]
&self,
id: DefIndex
) -> DefPath
pub(in rmeta::decoder) fn def_path_hash_unlocked(
&self,
index: DefIndex,
def_path_hashes: &mut FxHashMap<DefIndex, DefPathHash>
) -> DefPathHash[src]
&self,
index: DefIndex,
def_path_hashes: &mut FxHashMap<DefIndex, DefPathHash>
) -> DefPathHash
pub(in rmeta::decoder) fn def_path_hash(
&self,
index: DefIndex
) -> DefPathHash[src]
&self,
index: DefIndex
) -> DefPathHash
pub(in rmeta::decoder) fn all_def_path_hashes_and_def_ids(
&self
) -> Vec<(DefPathHash, DefId)>[src]
&self
) -> Vec<(DefPathHash, DefId)>
pub(in rmeta::decoder) fn get_crate_dep_node_index(
&self,
tcx: TyCtxt<'tcx>
) -> DepNodeIndex[src]
&self,
tcx: TyCtxt<'tcx>
) -> DepNodeIndex
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]
&self,
sess: &Session
) -> &'a [ImportedSourceFile]
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]
&self,
f: impl FnOnce(CrateDepKind) -> CrateDepKind
)
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]
&self
) -> usize
pub(in rmeta::decoder) fn local_def_id(
&self,
index: DefIndex
) -> DefId[src]
&self,
index: DefIndex
) -> DefId
pub(in rmeta::decoder) fn reverse_translate_def_id(
&self,
did: DefId
) -> Option<DefId>[src]
&self,
did: DefId
) -> Option<DefId>
Trait Implementations
impl<'a> Clone for CrateMetadataRef<'a>[src]
pub fn clone(&self) -> CrateMetadataRef<'a>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'a> Copy for CrateMetadataRef<'a>[src]
impl<'_> Deref for CrateMetadataRef<'_>[src]
type Target = CrateMetadata
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target[src]
impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a CrateMetadataRef<'a>[src]
pub(in rmeta) fn raw_bytes(
self
) -> &'a [u8][src]
self
) -> &'a [u8]
pub(in rmeta) fn cdata(
self
) -> Option<CrateMetadataRef<'a>>[src]
self
) -> Option<CrateMetadataRef<'a>>
pub(in rmeta) fn sess(
self
) -> Option<&'tcx Session>[src]
self
) -> Option<&'tcx Session>
pub(in rmeta) fn tcx(
self
) -> Option<TyCtxt<'tcx>>[src]
self
) -> Option<TyCtxt<'tcx>>
pub(in rmeta) fn decoder(
self,
pos: usize
) -> DecodeContext<'a, 'tcx>[src]
self,
pos: usize
) -> DecodeContext<'a, 'tcx>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,