Record stack size used by parser and apply it during error checking too
Summary:
The same files that were problematic during parsing are causing troubles when error checking too. We also need to be able to up the stack limit space for few outliers.
We can't / don't want to do it in the same way it was done there for two reasons:
- the "exponential retry" is based on ability to retry, which was easy in case of parser - we always start from "the scratch" (from the file), so it's easy to retry. Here, we are starting from syntax tree, and if the running function consumes it (not a case here, but will be in few other cases soon), there is no easy way to retry again
- it is done in a very invasive way, requiring running code to periodically check for stack space usage
Instead lets optimistically (and completely without any guarantees) assume that the space used while parsing is an upper bound of space used in subsequent phases. Getting the new thread to operate on a syntax tree passed from main one requires some ugly tricks to convince Rust that it is safe in that case.
Reviewed By: shiqicao, losvald
Differential Revision:
D17356084
fbshipit-source-id:
9f9580f374261d832a188b73cdfe4cc5908a2e9d