Struct rustc_metadata::creader::CStore
source · [−]pub struct CStore {
metas: IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>,
injected_panic_runtime: Option<CrateNum>,
allocator_kind: Option<AllocatorKind>,
has_global_allocator: bool,
pub(crate) stable_crate_ids: FxHashMap<StableCrateId, CrateNum>,
unused_externs: Vec<Symbol>,
}
Fields
metas: IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>
injected_panic_runtime: Option<CrateNum>
allocator_kind: Option<AllocatorKind>
This crate needs an allocator and either provides it itself, or finds it in a dependency. If the above is true, then this field denotes the kind of the found allocator.
has_global_allocator: bool
This crate has a #[global_allocator]
item.
stable_crate_ids: FxHashMap<StableCrateId, CrateNum>
This map is used to verify we get no hash conflicts between
StableCrateId
values.
unused_externs: Vec<Symbol>
Unused externs of the crate
Implementations
sourceimpl CStore
impl CStore
pub fn struct_field_names_untracked<'a>(
&'a self,
def: DefId,
sess: &'a Session
) -> impl Iterator<Item = Spanned<Symbol>> + 'a
pub fn struct_field_visibilities_untracked(
&self,
def: DefId
) -> impl Iterator<Item = Visibility<DefId>> + '_
pub fn ctor_def_id_and_kind_untracked(
&self,
def: DefId
) -> Option<(DefId, CtorKind)>
pub fn visibility_untracked(&self, def: DefId) -> Visibility<DefId>
pub fn module_children_untracked(
&self,
def_id: DefId,
sess: &Session
) -> Vec<ModChild>
pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro
pub fn fn_has_self_parameter_untracked(&self, def: DefId, sess: &Session) -> bool
pub fn crate_source_untracked(&self, cnum: CrateNum) -> Lrc<CrateSource>
pub fn get_span_untracked(&self, def_id: DefId, sess: &Session) -> Span
pub fn def_kind(&self, def: DefId) -> DefKind
pub fn crates_untracked(&self) -> impl Iterator<Item = CrateNum> + '_
pub fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usize
pub fn module_expansion_untracked(&self, def_id: DefId, sess: &Session) -> ExpnId
sourcepub fn num_def_ids_untracked(&self, cnum: CrateNum) -> usize
pub fn num_def_ids_untracked(&self, cnum: CrateNum) -> usize
Only public-facing way to traverse all the definitions in a non-local crate. Critically useful for this third-party project: https://github.com/hacspec/hacspec. See https://github.com/rust-lang/rust/pull/85889 for context.
pub fn item_attrs_untracked<'a>(
&'a self,
def_id: DefId,
sess: &'a Session
) -> impl Iterator<Item = Attribute> + 'a
pub fn get_proc_macro_quoted_span_untracked(
&self,
cnum: CrateNum,
id: usize,
sess: &Session
) -> Span
sourcepub fn traits_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = DefId> + '_
pub fn traits_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = DefId> + '_
Decodes all traits in the crate (for rustdoc).
sourcepub fn trait_impls_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = (DefId, DefId, Option<SimplifiedType>)> + '_
pub fn trait_impls_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = (DefId, DefId, Option<SimplifiedType>)> + '_
Decodes all trait impls in the crate (for rustdoc).
sourcepub fn inherent_impls_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = (DefId, DefId)> + '_
pub fn inherent_impls_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = (DefId, DefId)> + '_
Decodes all inherent impls in the crate (for rustdoc).
sourcepub fn incoherent_impls_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = DefId> + '_
pub fn incoherent_impls_in_crate_untracked(
&self,
cnum: CrateNum
) -> impl Iterator<Item = DefId> + '_
Decodes all incoherent inherent impls in the crate (for rustdoc).
pub fn associated_item_def_ids_untracked<'a>(
&'a self,
def_id: DefId,
sess: &'a Session
) -> impl Iterator<Item = DefId> + 'a
pub fn may_have_doc_links_untracked(&self, def_id: DefId) -> bool
sourceimpl CStore
impl CStore
pub fn from_tcx(tcx: TyCtxt<'_>) -> &CStore
fn alloc_new_crate_num(&mut self) -> CrateNum
pub fn has_crate_data(&self, cnum: CrateNum) -> bool
pub(crate) fn get_crate_data(&self, cnum: CrateNum) -> CrateMetadataRef<'_>
fn set_crate_data(&mut self, cnum: CrateNum, data: CrateMetadata)
pub(crate) fn iter_crate_data(
&self
) -> impl Iterator<Item = (CrateNum, &CrateMetadata)>
fn push_dependencies_in_postorder(&self, deps: &mut Vec<CrateNum>, cnum: CrateNum)
pub(crate) fn crate_dependencies_in_postorder(
&self,
cnum: CrateNum
) -> Vec<CrateNum>
fn crate_dependencies_in_reverse_postorder(
&self,
cnum: CrateNum
) -> Vec<CrateNum>
pub(crate) fn injected_panic_runtime(&self) -> Option<CrateNum>
pub(crate) fn allocator_kind(&self) -> Option<AllocatorKind>
pub(crate) fn has_global_allocator(&self) -> bool
pub fn report_unused_deps(&self, tcx: TyCtxt<'_>)
Trait Implementations
sourceimpl CrateStore for CStore
impl CrateStore for CStore
sourcefn def_key(&self, def: DefId) -> DefKey
fn def_key(&self, def: DefId) -> DefKey
Returns the DefKey
for a given DefId
. This indicates the
parent DefId
as well as some idea of what kind of data the
DefId
refers to.
fn as_any(&self) -> &dyn Any
fn crate_name(&self, cnum: CrateNum) -> Symbol
fn stable_crate_id(&self, cnum: CrateNum) -> StableCrateId
fn stable_crate_id_to_crate_num(
&self,
stable_crate_id: StableCrateId
) -> CrateNum
fn def_path(&self, def: DefId) -> DefPath
fn def_path_hash(&self, def: DefId) -> DefPathHash
sourcefn def_path_hash_to_def_id(&self, cnum: CrateNum, hash: DefPathHash) -> DefId
fn def_path_hash_to_def_id(&self, cnum: CrateNum, hash: DefPathHash) -> DefId
fn expn_hash_to_expn_id(
&self,
sess: &Session,
cnum: CrateNum,
index_guess: u32,
hash: ExpnHash
) -> ExpnId
sourcefn import_source_files(&self, sess: &Session, cnum: CrateNum)
fn import_source_files(&self, sess: &Session, cnum: CrateNum)
SourceFile
s from the given crate into the current session.
This normally happens automatically when we decode a Span
from
that crate’s metadata - however, the incr comp cache needs
to trigger this manually when decoding a foreign Span
Read moreAuto Trait Implementations
impl !RefUnwindSafe for CStore
impl !Send for CStore
impl !Sync for CStore
impl Unpin for CStore
impl !UnwindSafe for CStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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: 88 bytes