Struct rustc_metadata::creader::CrateMetadataRef [−][src]
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]
fn raw_proc_macro(&self, id: DefIndex) -> &ProcMacro[src]
fn try_item_ident(
&self,
item_index: DefIndex,
sess: &Session
) -> Result<Ident, String>[src]
&self,
item_index: DefIndex,
sess: &Session
) -> Result<Ident, String>
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]
&self,
kind: &EntryKind,
index: DefIndex,
parent_did: DefId,
sess: &Session
) -> VariantDef
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]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>
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)]ⓘ
fn get_super_predicates(
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> GenericPredicates<'tcx>[src]
&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)]ⓘ[src]
&self,
item_id: DefIndex,
tcx: TyCtxt<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]ⓘ
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]
&self,
id: DefIndex,
tcx: TyCtxt<'tcx>
) -> Option<TraitRef<'tcx>>
fn get_expn_that_defined(&self, id: DefIndex, sess: &Session) -> ExpnId[src]
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.
fn get_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)]ⓘ[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]
F: FnMut(Export<HirId>),
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]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> Result<Option<&'tcx [Node<'tcx>]>, ErrorReported>
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]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> IndexVec<Promoted, Body<'tcx>>
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]
&'a self,
id: DefIndex
) -> impl Iterator<Item = Variance> + 'a
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]
&'a self,
node_id: DefIndex,
sess: &'a Session
) -> impl Iterator<Item = Attribute> + 'a
fn get_struct_field_names(
&self,
id: DefIndex,
sess: &Session
) -> Vec<Spanned<Symbol>>[src]
&self,
id: DefIndex,
sess: &Session
) -> Vec<Spanned<Symbol>>
fn get_inherent_implementations_for_type(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> &'tcx [DefId]ⓘ[src]
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex
) -> &'tcx [DefId]ⓘ
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>)]ⓘ
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]
&self,
tcx: TyCtxt<'tcx>
) -> Lrc<FxHashMap<DefId, ForeignModule>>
fn get_dylib_dependency_formats(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)]ⓘ[src]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(CrateNum, LinkagePreference)]ⓘ
fn get_missing_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [LangItem]ⓘ[src]
fn get_fn_param_names(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> &'tcx [Ident]ⓘ[src]
fn exported_symbols(
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)]ⓘ[src]
&self,
tcx: TyCtxt<'tcx>
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)]ⓘ
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]
&self,
krate: CrateNum,
index_guess: u32,
hash: DefPathHash
) -> Option<DefId>
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]
&self,
index: DefIndex,
def_path_hashes: &mut FxHashMap<DefIndex, DefPathHash>
) -> DefPathHash
fn def_path_hash(&self, index: DefIndex) -> DefPathHash[src]
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]
&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]
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]
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.
fn deref(&self) -> &Self::Target[src]
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]
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>,