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

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

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

Fields

cdata: &'a CrateMetadatacstore: &'a CStore

Implementations

Iterates over all the stability attributes in the given crate.

Iterates over the language items in the given crate.

Iterates over the diagnostic items in the given crate.

Iterates over each child of the given item.

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>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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: 16 bytes