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

Do writeback of Closure params before visiting the parent expression #97302

Merged
merged 1 commit into from
May 25, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented May 23, 2022

This means that given the expression:

let x = |a: Vec<_>| {};

We will visit the HIR node for a before x, and report the ambiguity on the former instead of the latter. This also moves writeback for struct field ids and const blocks before, but the ordering of this and walking the expr doesn't seem to matter.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 23, 2022
@rust-highfive
Copy link
Collaborator

r? @cjgillot

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 23, 2022
@compiler-errors compiler-errors changed the title Do writeback of Closure/Struct/Field/ConstBlock ExprKinds before the parent expression Do writeback of Closure params before visiting the parent expression May 23, 2022
@cjgillot
Copy link
Contributor

I don't know this code well. What are the general effects of visit_node_id? Could this move change behaviour, or can it just change diagnostics?

@compiler-errors
Copy link
Member Author

@cjgillot: I'm pretty sure everything in rustc_typeck::check::writeback is just recording information to various tables. This is after we've done Infcx::resolve_regions, so we can't do any inference here anyways, and we shouldn't need to, since this happens after fallback.

As far as I can tell, this just changes the order that we discover hir nodes with unresolved inference vars in their types, so we provide a more specific error message in the closure case above.

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 25, 2022

📌 Commit e9215bb has been approved by cjgillot

@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 May 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request May 25, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#97302 (Do writeback of Closure params before visiting the parent expression)
 - rust-lang#97328 (rustc: Fix ICE in native library error reporting)
 - rust-lang#97351 (Output correct type responsible for structural match violation)
 - rust-lang#97398 (Add regression test for rust-lang#82830)
 - rust-lang#97400 (Fix a typo on Struct `Substructure`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d858d28 into rust-lang:master May 25, 2022
@bors
Copy link
Contributor

bors commented May 25, 2022

⌛ Testing commit e9215bb with merge 1b5e121...

@rustbot rustbot added this to the 1.63.0 milestone May 25, 2022
@compiler-errors compiler-errors deleted the writeback-ascending branch August 11, 2023 20:22
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