Struct rustc_codegen_llvm::debuginfo::metadata::TypeMap[][src]

pub struct TypeMap<'ll, 'tcx> {
    unique_id_interner: TypeIdInterner,
    unique_id_to_metadata: FxHashMap<UniqueTypeId, &'ll DIType>,
    type_to_metadata: FxHashMap<Ty<'tcx>, &'ll DIType>,
    type_to_unique_id: FxHashMap<Ty<'tcx>, UniqueTypeId>,
}
Expand description

The TypeMap is where the CrateDebugContext holds the type metadata nodes created so far. The metadata nodes are indexed by UniqueTypeId, and, for faster lookup, also by Ty. The TypeMap is responsible for creating UniqueTypeIds.

Fields

unique_id_interner: TypeIdInterner

The UniqueTypeIds created so far.

unique_id_to_metadata: FxHashMap<UniqueTypeId, &'ll DIType>

A map from UniqueTypeId to debuginfo metadata for that type. This is a 1:1 mapping.

type_to_metadata: FxHashMap<Ty<'tcx>, &'ll DIType>

A map from types to debuginfo metadata. This is an N:1 mapping.

type_to_unique_id: FxHashMap<Ty<'tcx>, UniqueTypeId>

A map from types to UniqueTypeId. This is an N:1 mapping.

Implementations

Adds a Ty to metadata mapping to the TypeMap. The method will fail if the mapping already exists.

Removes a Ty-to-metadata mapping. This is useful when computing the metadata for a potentially recursive type (e.g., a function pointer of the form:

fn foo() -> impl Copy { foo }

This kind of type cannot be properly represented via LLVM debuginfo. As a workaround, we register a temporary Ty to metadata mapping for the function before we compute its actual metadata. If the metadata computation ends up recursing back to the original function, it will use the temporary mapping for the inner self-reference, preventing us from recursing forever.

This function is used to remove the temporary metadata mapping after we’ve computed the actual metadata.

Adds a UniqueTypeId to metadata mapping to the TypeMap. The method will fail if the mapping already exists.

Gets the string representation of a UniqueTypeId. This method will fail if the ID is unknown.

Gets the UniqueTypeId for the given type. If the UniqueTypeId for the given type has been requested before, this is just a table lookup. Otherwise, an ID will be generated and stored for later lookup.

Gets the UniqueTypeId for an enum variant. Enum variants are not really types of their own, so they need special handling. We still need a UniqueTypeId for them, since to debuginfo they are real types.

Gets the unique type ID string for an enum variant part. Variant parts are not types and shouldn’t really have their own ID, but it makes set_members_of_composite_type() simpler.

Trait Implementations

Returns the “default value” for a type. Read more

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