Skip to content

[POST MERGE] rework non-fatal overflow handling to not depend on recursion depth #278

Description

@lcnr

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions