← board

Rust frontend — dyn Trait dispatch for arbitrary types

What it does

AN_INTF_FROM_CLASS/AN_INTF_CALL (defs.inc ~186-189) already build a data-ptr + vtable-ptr fat pointer for interface dispatch — same shape dyn Trait needs. The gap: current interfaces assume a class hierarchy underneath (COM/CORBA-style — only classes implement interfaces). Rust dyn Trait can wrap any type: structs, primitives, no inheritance required.

Needs a trait-impl table keyed by (concrete type, trait) independent of class hierarchy, so impl Display for MyStruct (a plain struct, not a class) can still produce a dyn Display fat pointer.

Scope

Acceptance

Log