This function will be used to help build the upcoming IncludeMatcher. While
Re2 is still used and behind a feature flag, this function returns an error
meant for fallback in the default case.
Hmm, I don't like to replicate this into Rust. I argued for a long time with Boris over a year ago that we should see if we can remove it from Python. He said they (Octobus, I think) would look into that if I would just queue the workaround for the time being. Could you see if you can simplify the Python code first instead?
See https://patchwork.mercurial-scm.org/patch/36755/ for discussion.
I am having a little trouble reading the patchwork thread, but I gather that you want to get rid of the preventive splitting of patterns and just let the regex engine handle it on its own? Was this measure taken because of a bug in Python's re or because its exceptions were too coarse/unusable?
I've looked into the behavior of Re2. It will return an error if the DFA runs out of memory, which seems perfectly reasonable.