-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Compiling a match on [T, ..N] uses O(N) stack space in rustc, leading to stack overflow #17877
Comments
Running it under GDB shows that it’s flipping back and forth between two functions recursively:
Whatever this recursive algorithm is needs to be made non-recursive. |
@pnkfelix I will try my best (this lunchtime), but I only have three hours experience with Rust so far. Every few lines of code written or modified requires 15 minutes of Googling the docs. (This learning curve is still much less steep than Haskell's was.) |
@chrisdew: feel free to drop by irc://irc.mozilla.org/#rust, you’ll get any help you need there quickly. |
@pnkfelix I was mistaken. I had a subsequent, chained, command on the command line which produced no output and hung. I mistook this for the compiler hanging. |
@chrisdew okay, great, thanks for the update! (I now feel better about asking you to do the narrowing rather than attempting to do it myself.) ;) |
Minimal test case:
If 1024 doesn’t do it for you, try bumping it upwards. 10000 ought to do it. Just don’t try numbers like a million or you’ll be waiting a while before it crashes. And if you have anything like systemd-coredump start automatically, it’ll be busy for a while as well… I guess there are a few areas where [T, ..N] is not handled well for large N.
(Additional keywords: sized array.)
The text was updated successfully, but these errors were encountered: