The new solver currently does not eagerly error when hitting the recursion limit. This is necessary for e.g. typenum #73.
However, this means increasing the recursion limit can significantly worsen performance, e.g. doubling the limit also doubles the compile times of typenum.
It also means that different crates can get different results for the same goal, which is quite subtle and can result in unsoundnesses if we're not careful #258
We've been floating the idea of instead detecting overflow based on type size. Scala and Ocaml detect overflow by checking whether we are reusing the same impl with a larger size. I didn't go with this for the new solver initially as it felt challenging to avoid breaking existing code while still actually preventing hangs.
I do by now think that we should try to get away from relying on the recursion_limit in this way and would like to experiment with this after stabilization. I think we can probably add this unstably and do crater runs and then enable the overflow checks on nightly by default for a while to get confidence in its behavior.
The new solver currently does not eagerly error when hitting the recursion limit. This is necessary for e.g.
typenum#73.However, this means increasing the recursion limit can significantly worsen performance, e.g. doubling the limit also doubles the compile times of
typenum.It also means that different crates can get different results for the same goal, which is quite subtle and can result in unsoundnesses if we're not careful #258
We've been floating the idea of instead detecting overflow based on type size. Scala and Ocaml detect overflow by checking whether we are reusing the same impl with a larger size. I didn't go with this for the new solver initially as it felt challenging to avoid breaking existing code while still actually preventing hangs.
I do by now think that we should try to get away from relying on the
recursion_limitin this way and would like to experiment with this after stabilization. I think we can probably add this unstably and do crater runs and then enable the overflow checks on nightly by default for a while to get confidence in its behavior.