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

HirIdification: almost there #58915

Merged
merged 7 commits into from Mar 8, 2019

Conversation

Projects
None yet
6 participants
@ljedrz
Copy link
Contributor

ljedrz commented Mar 4, 2019

The next iteration of HirIdification (#57578).

Replaces a bunch of NodeId method calls (mostly as_local_node_id) with HirId ones.

Removes NodeId from:

  • PathSegment
  • PatKind
  • Destination (replaces it with HirId)

In addition this PR also removes Visitor::visit_def_mention, which doesn't seem to be doing anything.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Mar 4, 2019

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@ljedrz

This comment has been minimized.

Copy link
Contributor Author

ljedrz commented Mar 4, 2019

r? @Zoxc

@rust-highfive rust-highfive assigned Zoxc and unassigned cramertj Mar 4, 2019

span_bug!(self.span(id), "body_owned_by: {} has no associated body",
self.node_to_string(id));
pub fn body_owned_by(&self, id: HirId) -> BodyId {
self.maybe_body_owned_by_by_hir_id(id).unwrap_or_else(|| {

This comment has been minimized.

@Zoxc

Zoxc Mar 4, 2019

Contributor

Maybe rename maybe_body_owned_by_by_hir_id to maybe_body_owned_by_hir_id? =P

This comment has been minimized.

@ljedrz

ljedrz Mar 4, 2019

Author Contributor

Yeah, that one does sound silly ^^. I'm hoping to soon be able to just remove it in favor of just maybe_body_owned_by.

@Zoxc

This comment has been minimized.

Copy link
Contributor

Zoxc commented Mar 4, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 4, 2019

📌 Commit 296eaa5 has been approved by Zoxc

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 7, 2019

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

@ljedrz ljedrz force-pushed the ljedrz:deprecate_nodeid_methods branch from 296eaa5 to cd06038 Mar 7, 2019

@ljedrz

This comment has been minimized.

Copy link
Contributor Author

ljedrz commented Mar 7, 2019

Rebased.

@ljedrz ljedrz referenced this pull request Mar 7, 2019

Closed

HirIdification: almost there #58992

3 of 3 tasks complete
@Zoxc

This comment has been minimized.

Copy link
Contributor

Zoxc commented Mar 7, 2019

@bors delegate+ r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 7, 2019

📌 Commit cd06038 has been approved by Zoxc

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 7, 2019

🌲 The tree is currently closed for pull requests below priority 500, this pull request will be tested once the tree is reopened

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 7, 2019

✌️ @ljedrz can now approve this pull request

@felix91gr

This comment has been minimized.

Copy link

felix91gr commented Mar 8, 2019

I don't know where to ask this otherwise, so please forgive me if the question is out of band.

Question:

I'm seeing HirIdification all over rustc and clippy. Is HirId intended to replace all uses of NodeId eventually? I'm asking because I'm working on a Clippy lint that tries to evaluate some values in order to detect a null -> reference tranmute call. When implementing evaluation of local variables (the one case we're missing), I saw that I needed to evaluate a Def::Local value, which as you can see in the link still uses NodeId.

Therefore, should I wait until the full HirIdification, or will this usage of NodeId keep being at the syntax-level?

Thank you so much, and sorry for disrupting your work 🙇

@Zoxc

This comment has been minimized.

Copy link
Contributor

Zoxc commented Mar 8, 2019

@felix91gr Eventually all NodeId uses after lowering to HIR will be replaced with HirId. NodeIds will still be used before that.

You can freely convert between NodeId and HirId though with tcx.hir().hir_to_node_id and tcx.hir().node_to_hir_id, so I don't see good reason to wait for anything here. You may just have to remove these calls and update your types later on.

@felix91gr

This comment has been minimized.

Copy link

felix91gr commented Mar 8, 2019

Eventually all NodeId uses after lowering to HIR will be replaced with HirId. NodeIds will still be used before that.

Ah, cool, that makes perfect sense :) thanks!

You can freely convert between NodeId and HirId though.

Ohhhhh! That's great, I didn't know that! Thank you 😊

@ljedrz

This comment has been minimized.

Copy link
Contributor Author

ljedrz commented Mar 8, 2019

@bors r=Zoxc

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 8, 2019

📌 Commit d7120e4 has been approved by Zoxc

@ljedrz ljedrz changed the title HirIdification: replace NodeId method calls HirIdification: almost there Mar 8, 2019

@ljedrz

This comment has been minimized.

Copy link
Contributor Author

ljedrz commented Mar 8, 2019

Added a clippy update that supersedes #58966. Bumping priority to 1.

@bors r=Zoxc p=1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 8, 2019

📌 Commit 24fad4c has been approved by Zoxc

@ljedrz ljedrz referenced this pull request Mar 8, 2019

Closed

Update Clippy #58966

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 8, 2019

⌛️ Testing commit 24fad4c with merge 2a65cbe...

bors added a commit that referenced this pull request Mar 8, 2019

Auto merge of #58915 - ljedrz:deprecate_nodeid_methods, r=Zoxc
HirIdification: almost there

The next iteration of HirIdification (#57578).

Replaces a bunch of `NodeId` method calls (mostly `as_local_node_id`) with `HirId` ones.

Removes `NodeId` from:
- [x] `PathSegment`
- [x] `PatKind`
- [x] `Destination` (replaces it with `HirId`)

In addition this PR also removes `Visitor::visit_def_mention`, which doesn't seem to be doing anything.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 8, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Zoxc
Pushing 2a65cbe to master...

@bors bors added the merged-by-bors label Mar 8, 2019

@bors bors merged commit 24fad4c into rust-lang:master Mar 8, 2019

1 check passed

homu Test successful
Details

@ljedrz ljedrz deleted the ljedrz:deprecate_nodeid_methods branch Mar 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.