Skip to main content

either_arm_guards

Function either_arm_guards 

Source
fn either_arm_guards(param: &str, ty: &Type) -> Vec<TokenStream>
Expand description

One compile-time assertion per leaf of the R arm of an Either choice parameter param of type ty (nested Eithers on the R side peeled): compilation fails when the leaf’s TryFromSexp is CHARACTER_ONLY, since the choice check never sends character or factor input there. Read through EitherArmProbe, so a leaf without TryFromSexp adds no error of its own. Empty without an Either layer.

Each guard is a block holding only items (the fallback trait import and a const _ assertion), spanned on the leaf: the assertion is evaluated by cargo check too, and the error points at the arm.