Skip to main content

relate_shapes

Function relate_shapes 

Source
pub fn relate_shapes(
    cx: &mut Cx,
    left: &dyn Shape,
    right: &dyn Shape,
    probes: &[ShapeProbe],
) -> Result<ShapeRelation>
Expand description

Compare two shapes with conservative proof rules plus optional probes.

let exact_true = ExactExprShape::new(Expr::Bool(true));
let bool_expr = ExprKindShape::new(ExprKind::Bool);
let relation = relate_shapes(&mut cx, &exact_true, &bool_expr, &[]).unwrap();

assert_eq!(relation.kind, ShapeRelationKind::LeftSubshape);
assert!(relation.proven);