Skip to content

Commit 58fd7c6

Browse files
committed
Handle multiple leaf goals in LowerGoal
1 parent a532519 commit 58fd7c6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/ir/lowering/mod.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -995,10 +995,16 @@ impl<'k> LowerGoal<Env<'k>> for Goal {
995995
}
996996
Goal::Not(g) => Ok(Box::new(ir::Goal::Not(g.lower(env)?))),
997997
Goal::Leaf(wc) => {
998-
let leaf = wc.lower(env)?;
999-
assert_eq!(1, leaf.len());
1000-
let leaf = leaf.into_iter().next().unwrap();
1001-
Ok(Box::new(ir::Goal::Leaf(leaf)))
998+
// A where clause can lower to multiple leaf goals; wrap these in Goal::And.
999+
let mut leaves = wc.lower(env)?.into_iter();
1000+
let mut goal = Box::new(ir::Goal::Leaf(leaves.next().unwrap()));
1001+
for leaf in leaves {
1002+
goal = Box::new(ir::Goal::And(
1003+
goal,
1004+
Box::new(ir::Goal::Leaf(leaf)),
1005+
));
1006+
}
1007+
Ok(goal)
10021008
}
10031009
}
10041010
}

0 commit comments

Comments
 (0)