-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 infinite recursion in type checker on recursive items #17264
Conversation
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment here explaining briefly what this file does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix
LGTM, just a few nits to clear up. |
7d5475d
to
2d21489
Compare
Force pushed new version with fixes |
This new pass is run before type checking so that recursive items are detected beforehand. This prevents going into an infinite recursion during type checking when a recursive item is used in an array type. As a bonus, use `span_err` instead of `span_fatal` so multiple errors can be reported. Closes issue rust-lang#17252
2d21489
to
0818955
Compare
After some more discussion on IRC, I tweaked the pass to use |
Recursive items are currently detected in the `check_const` pass which runs after type checking. This means a recursive static item used as an array length will cause type checking to blow the stack. This PR separates the recursion check out into a separate pass which is run before type checking. Closes issue #17252 r? @nick29581
Recursive items are currently detected in the
check_const
pass which runs after type checking. This means a recursive static item used as an array length will cause type checking to blow the stack. This PR separates the recursion check out into a separate pass which is run before type checking.Closes issue #17252
r? @nick29581