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§
Sourcefn insert(
&self,
decl: T,
parsed_decl_id: ParsedDeclId<T::ParsedType>,
) -> DeclRef<DeclId<T>>
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.
Sourcefn insert_modified(
&self,
modified_decl: T,
original_decl: DeclId<T>,
) -> DeclRef<DeclId<T>>
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§
impl DeclEngineInsert<TyAbiDecl> for DeclEngine
impl DeclEngineInsert<TyConfigurableDecl> for DeclEngine
impl DeclEngineInsert<TyConstGenericDecl> for DeclEngine
impl DeclEngineInsert<TyConstantDecl> for DeclEngine
impl DeclEngineInsert<TyEnumDecl> for DeclEngine
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.