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

Cleanup path-to-local checks #6660

Merged
merged 1 commit into from
Feb 7, 2021
Merged

Conversation

camsteffen
Copy link
Contributor

changelog: none

It seemed like too much ceremony going on to check if an expression matches a variable. So I created two util functions path_to_local(Expr) -> Option<HirId> and path_to_local_id(Expr, HirId) -> bool to make this easier, and used them wherever applicable.

I changed logic in a few places to use HirId instead of Symbol where it was easy to do so. I believe this is more correct and may even fix some bugs.

I also removed some calls to qpath_res. This is not needed if you are only looking for a Res::Local.

As a note, I wanted to name the util functions in a way that encourages understanding of the HIR.

@rust-highfive
Copy link

r? @llogiq

(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 Feb 2, 2021
@bors
Copy link
Contributor

bors commented Feb 4, 2021

☔ The latest upstream changes (presumably #6646) made this pull request unmergeable. Please resolve the merge conflicts.

@llogiq
Copy link
Contributor

llogiq commented Feb 7, 2021

Sorry for taking so long to review. @bors r+

@bors
Copy link
Contributor

bors commented Feb 7, 2021

📌 Commit 56f7fbb has been approved by llogiq

@bors
Copy link
Contributor

bors commented Feb 7, 2021

⌛ Testing commit 56f7fbb with merge d51db24...

@bors
Copy link
Contributor

bors commented Feb 7, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing d51db24 to master...

@bors bors merged commit d51db24 into rust-lang:master Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants