Skip to content
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

Break when there is a mismatch in the type count #83535

Merged
merged 2 commits into from
Apr 2, 2021

Conversation

MidasLamb
Copy link
Contributor

@MidasLamb MidasLamb commented Mar 26, 2021

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
Fixes #83499

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 26, 2021
@MidasLamb
Copy link
Contributor Author

I'm not sure if the code in #83499 should be added as a test or not, hence the draft status.
I'm also not 100% on the message.

@petrochenkov
Copy link
Contributor

Could someone else review this? I'm not familiar with the area.
r? @nikomatsakis

@JohnTitor
Copy link
Member

@MidasLamb Yeah, it'd be great if we could add a test. If you aren't sure how to add, see this page: https://rustc-dev-guide.rust-lang.org/tests/adding.html

@nikomatsakis
Copy link
Contributor

This looks great except for needing a test, agreed.

@nikomatsakis nikomatsakis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 1, 2021
Add a test that has the right input to trigger an out-of-bounds
error when in MIR the local_decls and the normalized_input_tys don't
match in amount.
@MidasLamb
Copy link
Contributor Author

@JohnTitor , @nikomatsakis , I've added the test, was a bit more figuring out than I anticipated because I couldn't really find a place for "this shouldn't crash the compiler" and not make any other assumptions.

@nikomatsakis nikomatsakis marked this pull request as ready for review April 1, 2021 19:26
@nikomatsakis
Copy link
Contributor

Looks good!

@bors r+

@bors
Copy link
Contributor

bors commented Apr 1, 2021

📌 Commit 2d813b2 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 1, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 1, 2021
…r=nikomatsakis

Break when there is a mismatch in the type count

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
Fixes rust-lang#83499
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…r=nikomatsakis

Break when there is a mismatch in the type count

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
Fixes rust-lang#83499
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…r=nikomatsakis

Break when there is a mismatch in the type count

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
Fixes rust-lang#83499
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2021
Rollup of 5 pull requests

Successful merges:

 - rust-lang#83535 (Break when there is a mismatch in the type count)
 - rust-lang#83721 (Add a button to copy the "use statement")
 - rust-lang#83740 (Fix comment typo in once.rs)
 - rust-lang#83745 (Add my new email address to .mailmap)
 - rust-lang#83754 (Add test to ensure search tabs behaviour)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 03ba8ab into rust-lang:master Apr 2, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
7 participants