Skip to main content

Module traits

Module traits 

Source
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:

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§

ImplEntry
A record of a single impl block registered in the ImplTable.
ImplTable
Maps (TraitRef, Type) pairs to impl blocks and supports method dispatch.
ResolvedMethod
The result of a successful method dispatch via resolve_method.
TraitRef
A reference to a named trait, identified by its fully-qualified name.

Functions§

check_supertrait_obligations
Check that all transitively required supertraits of trait_ref are satisfied by ty in impls.
resolve_impl
Find the impl block that satisfies trait_ref for ty in impls.
resolve_method
Dispatch a method call on receiver by searching impls.
type_key
Produce a canonical string key for a Type.

Type Aliases§

ImplId
Unique identifier for a registered impl block.