-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Handle C-variadic arguments properly when reporting region errors #86164
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
||
fn ordering4 < 'a , 'b > ( a : , self , self , self , | ||
self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { | ||
} |
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.
Does this need to be formatted like this or can you run rustfmt on it?
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.
It doesn't need to be, but since this is a regression test, I have tried to reproduce the example from #86053 as closely as possible (the line break had to happen in order to make test tidy
happy).
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.
Apologies for the delay in reviewing, this looks good to me.
@bors r+ |
📌 Commit 7dccce0 has been approved by |
☀️ Test successful - checks-actions |
This pull request fixes #86053. The issue is that for a C-variadic function
foo
's signature will contain only the first parameter (and havec_variadic
set totrue
), whereas its body has a second argument (ahir::Pat
for the...
).The code for reporting region errors iterates over the body's parameters and tries to fetch the corresponding parameter from the signature; this causes an out-of-bounds ICE for the
...
(though not in the example above, because there are no region errors to report).I have simply restricted the iteration over the body parameters to exclude
...
, which is fine because...
cannot cause a region error.