Skip to main content

polymorphic_recursion_edges

Function polymorphic_recursion_edges 

Source
pub fn polymorphic_recursion_edges(
    decl: &TypeDecl,
    types: &HashMap<String, Arc<TypeDecl>>,
) -> Vec<(String, Span)>
Expand description

#3192: the recursive edges of generic type decl that are not uniform, as (callee, span). A recursive edge is an application, in the body, of a generic that reaches decl again (decl itself, or a mutually recursive partner); it is uniform when its arguments are exactly decl’s own type parameters, in order. Anything else (Weird[List[T]] inside Weird[T], Pair[B, A] inside Pair[A, B]) is polymorphic recursion, which generates an unbounded set of instantiations and is refused at the declaration (bynk.generics.polymorphic_recursion). Conservative by design.