Uh oh!
There was an error while loading. Please reload this page.
Use typed indices in argument mismatch algorithm - #97542
Merged
Merged
Conversation
rust-highfive
commented
May 30, 2022
Contributor
(rust-highfive has picked a reviewer for you, use r? to override) |
compiler-errorsforce-pushed
the
arg-mismatch
branch
from
May 30, 2022 06:38
9b2c84b to
cd4cf1fComparefbstj
reviewed
May 30, 2022
Contributor
There was a problem hiding this comment.
Suggested change
| returneliminated; | |
| eliminated |
Kvicii
approved these changes
May 30, 2022
jackh726
commented
May 30, 2022
Member
Overall, I like this. But it's going to take me a bit to review. This is too big to backport imo. I'd prefer a much more targeted fix. |
petrochenkov
commented
May 30, 2022
Contributor
r? @jackh726 |
compiler-errors added a commit
to compiler-errors/rust
that referenced
this pull request
Jun 8, 2022
…r=jackh726 Fix indices and remove some unwraps in arg mismatch algorithm This is a more conservative fix than rust-lang#97542, addressing some indices which were used incorectly and unwraps which are bound to panic (e.g. when the provided and expected arg counts differ). Beta nominating this as it's quite easy to cause ICEs -- I wrote a fuzzer and found hundreds of examples of ICEs. cc `@jackh726` as author of rust-lang#92364, and `@estebank` as reviewer of that PR. fixesrust-lang#97484 r? `@jackh726` this should be _much_ easier to review than the other PR 😅
bors
commented
Jun 9, 2022
Collaborator
☔ The latest upstream changes (presumably #97896) made this pull request unmergeable. Please resolve the merge conflicts. |
jackh726
commented
Jun 26, 2022
Member
r=me after rebase |
compiler-errorsforce-pushed
the
arg-mismatch
branch
from
June 28, 2022 04:52
cd4cf1f to
b177c9bComparecompiler-errors
commented
Jun 28, 2022
ContributorAuthor
@bors r=jackh726 |
bors
commented
Jun 28, 2022
Collaborator
📌 Commit b177c9bef1a3e756a8c4c97d6382b340c361e9ce has been approved by |
compiler-errorsforce-pushed
the
arg-mismatch
branch
from
June 28, 2022 04:53
b177c9b to
f2277e0Comparecompiler-errors
commented
Jun 28, 2022
ContributorAuthor
@bors r=jackh726 |
bors
commented
Jun 28, 2022
Collaborator
📌 Commit f2277e0 has been approved by |
bors added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 29, 2022
Rollup of 7 pull requests Successful merges: - rust-lang#97423 (Simplify memory ordering intrinsics) - rust-lang#97542 (Use typed indices in argument mismatch algorithm) - rust-lang#97786 (Account for `-Z simulate-remapped-rust-src-base` when resolving remapped paths) - rust-lang#98277 (Fix trait object reborrow suggestion) - rust-lang#98525 (Add regression test for rust-lang#79224) - rust-lang#98549 (interpret: do not prune requires_caller_location stack frames quite so early) - rust-lang#98603 (Some borrowck diagnostic fixes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Dylan-DPC added a commit
to Dylan-DPC/rust
that referenced
this pull request
Jun 29, 2022
…on, r=oli-obk Clean up arg mismatch diagnostic, generalize tuple wrap suggestion This is based on top of rust-lang#97542, so just look at the last commit which contains the relevant changes. 1. Remove `final_arg_types` which was one of the last places we were using raw (`usize`) indices instead of typed indices in the arg mismatch suggestion code. 2. Improve the tuple wrap suggestion, now we suggest things like `call(a, b, c, d)` -> `call(a, (b, c), d)` 😺 3. Folded in fixrust-lang#98645
Dylan-DPC added a commit
to Dylan-DPC/rust
that referenced
this pull request
Jun 29, 2022
…on, r=oli-obk Clean up arg mismatch diagnostic, generalize tuple wrap suggestion This is based on top of rust-lang#97542, so just look at the last commit which contains the relevant changes. 1. Remove `final_arg_types` which was one of the last places we were using raw (`usize`) indices instead of typed indices in the arg mismatch suggestion code. 2. Improve the tuple wrap suggestion, now we suggest things like `call(a, b, c, d)` -> `call(a, (b, c), d)` 😺 3. Folded in fixrust-lang#98645
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I kinda went overboard with the renames, but in general, "arg" is renamed to "expected", and "input" is renamed to "provided", and we use new typed indices to make sure we're indexing into the right sized array.
Other drive-by changes:
break 'labelto escape it.final_arg_types, which is never populated for arguments greater than the number of expected args. Instead, we just grab the final coerced expression type fromin_progress_typeck_results._.Also, sorry in advance, I kinda want to backport this but I know I have folded in a lot of unnecessary drive-by changes that might discourage that. I would be open to brainstorming how to get some of these changes on beta at least.edit: Minimized the ICE-fixing changes to #97557cc @jackh726 as author of #92364, and @estebank as reviewer of the PR.
fixes#97484