Skip to main content

DeclEngineInsert

Trait DeclEngineInsert 

Source
pub trait DeclEngineInsert<T>{
    // Required methods
    fn insert(
        &self,
        decl: T,
        parsed_decl_id: ParsedDeclId<T::ParsedType>,
    ) -> DeclRef<DeclId<T>>;
    fn insert_modified(
        &self,
        modified_decl: T,
        original_decl: DeclId<T>,
    ) -> DeclRef<DeclId<T>>;
}

Required Methods§

Source

fn insert( &self, decl: T, parsed_decl_id: ParsedDeclId<T::ParsedType>, ) -> DeclRef<DeclId<T>>

Inserts a typed declaration decl that corresponds to the parsed declaration parsed_decl_it into the DeclEngine for the first time.

This method is meant to be called only during the initial type checking, when the typed declaration is created for the first time.

Source

fn insert_modified( &self, modified_decl: T, original_decl: DeclId<T>, ) -> DeclRef<DeclId<T>>

Inserts a typed declaration modified_decl that represents a modified version of an original_decl. E.g., during monomorphization, we get an original typed declaration from the DeclEngine, modify it, and insert the modified_decl into the DeclEngine.

The modified_decl will have the same corresponding parsed declaration as the original_decl.

Panics if the original_decl does not exist in the DeclEngine or if it doesn’t have its corresponding parsed declaration.

The only typed declarations that legitimately have no corresponding parsed declaration are the trait-interface dummy functions inserted via DeclEngine::insert_dummy_func. For those, DeclEngineInsert is implemented manually (see the implementation for ty::TyFunctionDecl).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl DeclEngineInsert<TyAbiDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyConfigurableDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyConstGenericDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyConstantDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyEnumDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyFunctionDecl> for DeclEngine

ty::TyFunctionDecl is intentionally not implemented via the decl_engine_insert! macro. Unlike all other typed declarations, functions have one legitimate case of not having a corresponding parsed declaration: the trait-interface dummy functions inserted via DeclEngine::insert_dummy_func. insert_modified must therefore tolerate a missing parsed declaration, but only for such dummy functions.

Source§

impl DeclEngineInsert<TyImplSelfOrTrait> for DeclEngine

Source§

impl DeclEngineInsert<TyStorageDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyStructDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyTraitDecl> for DeclEngine

Source§

impl DeclEngineInsert<TyTraitFn> for DeclEngine

Source§

impl DeclEngineInsert<TyTraitType> for DeclEngine

Source§

impl DeclEngineInsert<TyTypeAliasDecl> for DeclEngine