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

Subtype FRU fields first in type_changing_struct_update #98013

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

compiler-errors
Copy link
Member

So this fixes a subtle bug that type_changing_struct_update introduced, where it'll no longer coerce the base expr correctly. I actually think this code is easier to understand now, too.

r? @lcnr since you reviewed the last one

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 12, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 12, 2022
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so to summarize:

The current approach first does subtyping + opt coercion from the base expr to TargetTy<?0..?N> where ?0 to ?N are fresh inference var.

The second approach first does subtyping of TargetTy<?0..?N> to our actual target ty and then does subtyping + coercions between the inferred target ty and the base type.

The new approach can do more coercions as we know more about the target type at that point.

@lcnr
Copy link
Contributor

lcnr commented Jun 14, 2022

two nits, then r=me

@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jun 17, 2022

📌 Commit 784e28e has been approved by lcnr

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 17, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 17, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#95392 (std: Stabilize feature try_reserve_2 )
 - rust-lang#97798 (Hide irrelevant lines in suggestions to allow for suggestions that are far from each other to be shown)
 - rust-lang#97844 (Windows: No panic if function not (yet) available)
 - rust-lang#98013 (Subtype FRU fields first in `type_changing_struct_update`)
 - rust-lang#98191 (Remove the rest of unnecessary `to_string`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4793397 into rust-lang:master Jun 17, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 17, 2022
@compiler-errors compiler-errors deleted the guide-inference-2 branch August 11, 2023 20:02
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants