-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix ICE for functions with more than 65535 arguments #88733
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. Please see the contribution instructions for more information. |
While on one hand this fixes the stated issue in sense, it would be nice if the compiler could recognize when a function overflowed the maximum number of parameters, so it would never ICE even on [insert arbitrarily large number here] |
That makes sense. The error in the issue comes from trying to convert a |
See this comment for a more reasonably sized test case. In order to avoid unnecessary deleted big files in git, I'd suggest you also do a rebase / amend and force-push in order to remove your huge test file. |
Good idea, but changing parameter index type to type which range will not be used in 99,99..% of real cases isn't looking good. C++ have limit about ~256 (+-, different values in different compilers). |
What's the point of having so many arguments? |
I would prefer to go with @CraftSpider's approach: catch an overflowing number of args earlier in the process, emit an error and recover (by maybe clamping the |
If so, should I change |
@rustbot label: +T-lang |
I would change it back, yes. We can do a crater run to check if any open source project has code exploiting this and I would expect that the only change would be that what was formerly an ICE would be a proper error and no other difference in user visible behavior for valid code. |
@bors r+ |
📌 Commit 804ccfa has been approved by |
…ingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#87904 (Reword description of automatic impls of `Unsize`.) - rust-lang#88147 (Fix non-capturing closure return type coercion) - rust-lang#88209 (Improve error message when _ is used for in/inout asm operands) - rust-lang#88668 (Change more x64 size checks to not apply to x32.) - rust-lang#88733 (Fix ICE for functions with more than 65535 arguments) - rust-lang#88757 (Suggest wapping expr in parentheses on invalid unary negation) - rust-lang#88779 (Use more accurate spans for "unused delimiter" lint) - rust-lang#88830 (Add help for E0463) - rust-lang#88849 (don't clone types that are Copy (clippy::clone_on_copy)) - rust-lang#88850 (don't convert types into identical types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This pull request fixes #88577 by changing the
param_idx
field in theParam
variant ofWellFormedLoc
fromu16
tou32
, thus allowing for more than 65,535 arguments in a function. Note that I also added a regression test, but needed to add// ignore-tidy-filelength
because the test is more than 8000 lines long.