Expand description
Trait resolution — ImplTable construction, impl/method dispatch,
coherence checking, associated-type resolution, and supertrait obligations.
§Overview
The ImplTable is the central data structure. It is built from an AIR
module node by ImplTable::build_from, which walks all top-level
NodeKind::ImplBlock items and registers them. Two free functions then
provide the main resolution queries:
resolve_impl— find theImplIdfor a(trait, type)pair.resolve_method— dispatch a.method()call on a receiver type.
Coherence checking (exact-type overlap detection) runs during construction. Generic-parameter impls are registered but exempted from the coherence check.
§Supertrait obligations
Call check_supertrait_obligations after resolve_impl to verify that
all transitively required supertraits are also satisfied.
Structs§
- Impl
Entry - A record of a single impl block registered in the
ImplTable. - Impl
Table - Maps
(TraitRef, Type)pairs to impl blocks and supports method dispatch. - Resolved
Method - The result of a successful method dispatch via
resolve_method. - Trait
Ref - A reference to a named trait, identified by its fully-qualified name.
Functions§
- check_
supertrait_ obligations - Check that all transitively required supertraits of
trait_refare satisfied bytyinimpls. - resolve_
impl - Find the impl block that satisfies
trait_reffortyinimpls. - resolve_
method - Dispatch a method call on
receiverby searchingimpls. - type_
key - Produce a canonical string key for a
Type.
Type Aliases§
- ImplId
- Unique identifier for a registered impl block.