Skip to main content

trait_bound_bridge_call

Function trait_bound_bridge_call 

Source
pub fn trait_bound_bridge_call<'a>(
    call_node: &'a AIRNode,
    callee: &'a AIRNode,
    args: &'a [AirArg],
    trait_decls: &TraitDeclRegistry,
) -> Option<(&'a AIRNode, &'a str, &'a [AirArg], &'a str)>
Expand description

Recognise a desugared sealed-core-trait bridge method call on a bounded generic type variable.

The generic analogue of primitive_bridge_call: building on desugared_self_call, this additionally requires that (a) the call_node carries the checker’s recv_kind = "TraitBound:<Trait>" annotation, (b) the trait is one of the compiler-provided sealed core traits (bock_types::traits::SEALED_CORE_TRAITS) and is NOT declared in trait_decls (i.e. it is the primitive conformance, not a user trait that happens to share the name), and (c) the method is one of PRIMITIVE_BRIDGE_METHODS.

When all three hold the method dispatches through a sealed core trait whose primitive instantiations (Int/String/Bool) have no .eq/.compare method in any target, so each backend must lower it to the target intrinsic — exactly as the Primitive:<Ty> bridge does, but driven by the generic bound rather than a concrete receiver type. Returns the receiver node, the method name, the remaining (non-self) arguments, and the trait name.

A TraitBound:<Trait> whose trait IS user-declared is left to the normal trait-dispatch lowering (the user impl provides the method); a non-sealed trait bound is likewise untouched.