pub struct TraitDef {
pub def_id: DefId,
pub name: String,
pub supertraits: Vec<DefId>,
pub methods: Vec<TraitMethod>,
pub assoc_types: Vec<(String, DefId)>,
}Expand description
A trait declaration with its method signatures.
Fields§
§def_id: DefId§name: String§supertraits: Vec<DefId>Traits this one requires (trait Ord: Eq → [Eq]), resolved and
deduplicated. Direct supertraits only — the transitive closure is taken
where it is needed, so a cyclic declaration cannot make this list
infinite.
The graph formed by these lists can itself be cyclic: trait A: B
together with trait B: A is accepted (nova-typeck only ever
requires satisfiability, not acyclicity). A transitive walk over this
field — chasing supertraits into each named trait’s own
supertraits, and so on — must therefore track which traits it has
already visited, or it will loop forever on such a declaration. (The
existing transitive expansion in nova-typeck does this by construction:
it only ever appends an id it has not already recorded.)
methods: Vec<TraitMethod>§assoc_types: Vec<(String, DefId)>Associated types this trait declares, in declaration order, each with
its own DefId (DefKind::AssocType). An impl must bind every one of
them; check_impl_conformance enforces that.