-
Notifications
You must be signed in to change notification settings - Fork 13.3k
MIR inlining introduces trait solver overflows #106147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is only an overflow with a ridiculously low recursion limit, right? Most code that makes its way to codegen also fails to compile with That's just a consequence of the fact MIR inlining calls |
This example, yes, but with larger examples this should easily reproduce for any recursion limit.
Sure, but enabling optimizations should really never cause new errors to be produced |
I'm not convinced that this is a bug, or at least, I'm pretty sure this is not a bug worth solving. Random lints and even modifications to typechecking can cause us to change the obligations we end up needing to validate during the compilation process. Even the choice of compilation phase (check/build, library/bin) can change what we end up solving. At a more meta-level, I don't think we consider the minimum successfully compileable recursion depth to be something that is stable across releases -- it's kind of a compiler detail 😓 we only really expose this detail because people hit the upper limit too much with their deep monomorphizations. I dug up this comment that seems to echo that sentiment #79909 (comment) (I think, maybe @Mark-Simulacrum can correct me if I'm taking his words incorrectly), but couldn't really find anything else that sets this in stone, so take my words with a grain of salt. In any case, I'd prefer a more realistic example to demonstrate the issue in practice... Or perhaps some background as to why you stumbled upon this? |
I agree, but that is not the issue here. Changes to whether or not this overflows between compiler versions are completely fine - the thing I'm claiming is a bug is specifically that
No practical example, just working on some stuff that happened to get me to think about this interaction |
It might be interesting to keep an eye on this. The MIR inliner has some HUGE restrictions on it right now with the default settings, it is restricted based on both the caller and the callee. These restrictions are pretty artificial and conservative, and we should lift them at some point by fixing our inline cost estimation. I would not be surprised if we see a lot more recursion in the inliner when we get to that. But for this issue: Is there anything else we could do that wouldn't count against the recursion limit? |
Code: (playground)
This produces
If and only if MIR inlining is turned on. I'm not sure why, but that seems like a bug.
Meta
rustc --version --verbose
:Reproduced by compiling the above code with each of:
This regressed when MIR inlining was turned on in stable, but since this is just an overflow regression I'm not going to add the label.
@rustbot label +T-compiler +A-mir-opt +A-mir-opt-inlining
The text was updated successfully, but these errors were encountered: