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

process trait/impl items directly from the visitor callback #39000

Merged

Conversation

nikomatsakis
Copy link
Contributor

The current setup processes impl/trait items while visiting
the impl/trait. This means we basically have this setup:

<Lots> -> TypeckItemBody(Impl) -> Tables(ImplItem{0,1,2,3})

But this was largely an artifact of the older code. By moving the
processing of items into method dedicated for their use, we produce this
setup:

<Little> -> TypeckItemBody(ImplItem0) -> Tables(ImplItem0)
...
<Little> -> TypeckItemBody(ImplItem3) -> Tables(ImplItem3)

r? @michaelwoerister

Also, we might consider removing the TypeckItemBody node altogether and just using Tables as the task. Tables is its primary output, I imagine? That would reduce size of dep-graph somewhat.

cc @eddyb -- perhaps this pattern applies elsewhere?

@eddyb
Copy link
Member

eddyb commented Jan 11, 2017

LGTM. I agree with Tables, that was my intent.

@nikomatsakis
Copy link
Contributor Author

Not as an argument against eliminating TypeckItemBody exactly, but it's worth noting that type-checking the item body produces primarily a Tables but also a TypeckItemSignature for the various closures in the body.

@eddyb
Copy link
Member

eddyb commented Jan 12, 2017

The whole closure situation is a bit troublesome. It'd be better to actually compute (copy, really) that information from the surrounding function's Tables (and I believe I should've just done that instead of what it is now).

Copy link
Member

@eddyb eddyb left a comment

Choose a reason for hiding this comment

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

LGTM except one doc nit.

whether the node is inlined or not and do the right thing.
whether the node is inlined or not and do the right thing. You can
also use `tcx.map.is_inlined_def_id()` and
`tcx.map.is_inlined_node_id()` to test.
Copy link
Member

Choose a reason for hiding this comment

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

None of this happens anymore, inlined bodies don't get their own local NodeIds or DefIds.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

@michaelwoerister
Copy link
Member

Looks good to me! One nit: "Tables" is a rather generic name for the dep-node that says little about what it represents. If you can think of a more descriptive name, now would be the time to change it, I guess.
Not a priority though. r=me with @eddyb's comment addressed.

@eddyb
Copy link
Member

eddyb commented Jan 13, 2017

TypedHirTables is maybe the most descriptive sequence of 3 words I can come up with.

The current setup processes impl/trait items while visiting
the impl/trait. This means we basically have this setup:

    <Lots> -> TypeckItemBody(Impl) -> Tables(ImplItem{0,1,2,3})

But this was largely an artifact of the older code. By moving the
processing of items into method dedicated for their use, we produce this
setup:

    <Little> -> TypeckItemBody(ImplItem0) -> Tables(ImplItem0)
    ...
    <Little> -> TypeckItemBody(ImplItem3) -> Tables(ImplItem3)
@nikomatsakis nikomatsakis force-pushed the incr_comp_crosscontaminate_impl_item branch from 2595ae8 to 282f7a3 Compare January 25, 2017 21:24
@michaelwoerister
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 25, 2017

📌 Commit 282f7a3 has been approved by michaelwoerister

@bors
Copy link
Contributor

bors commented Jan 26, 2017

⌛ Testing commit 282f7a3 with merge 2f0463a...

bors added a commit that referenced this pull request Jan 26, 2017
…tem, r=michaelwoerister

process trait/impl items directly from the visitor callback

The current setup processes impl/trait items while visiting
the impl/trait. This means we basically have this setup:

    <Lots> -> TypeckItemBody(Impl) -> Tables(ImplItem{0,1,2,3})

But this was largely an artifact of the older code. By moving the
processing of items into method dedicated for their use, we produce this
setup:

    <Little> -> TypeckItemBody(ImplItem0) -> Tables(ImplItem0)
    ...
    <Little> -> TypeckItemBody(ImplItem3) -> Tables(ImplItem3)

r? @michaelwoerister

Also, we might consider removing the `TypeckItemBody` node altogether and just using `Tables` as the task. `Tables` is its primary output, I imagine? That would reduce size of dep-graph somewhat.

cc @eddyb -- perhaps this pattern applies elsewhere?
@bors
Copy link
Contributor

bors commented Jan 26, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing 2f0463a to master...

@bors bors merged commit 282f7a3 into rust-lang:master Jan 26, 2017
@nikomatsakis nikomatsakis deleted the incr_comp_crosscontaminate_impl_item branch April 14, 2017 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants