File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use lalrpop_intern::intern;
6
6
use cast:: { Cast , Caster } ;
7
7
use errors:: * ;
8
8
use ir:: { self , Anonymize , ToParameter } ;
9
+ use itertools:: Itertools ;
9
10
use solve:: SolverChoice ;
10
11
11
12
mod test;
@@ -995,10 +996,11 @@ impl<'k> LowerGoal<Env<'k>> for Goal {
995
996
}
996
997
Goal :: Not ( g) => Ok ( Box :: new ( ir:: Goal :: Not ( g. lower ( env) ?) ) ) ,
997
998
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) ) )
999
+ // A where clause can lower to multiple leaf goals; wrap these in Goal::And.
1000
+ let leaves = wc. lower ( env) ?. into_iter ( ) . map ( ir:: Goal :: Leaf ) ;
1001
+ let goal = leaves. fold1 ( |goal, leaf| ir:: Goal :: And ( Box :: new ( goal) , Box :: new ( leaf) ) )
1002
+ . expect ( "at least one goal" ) ;
1003
+ Ok ( Box :: new ( goal) )
1002
1004
}
1003
1005
}
1004
1006
}
You can’t perform that action at this time.
0 commit comments