Skip to content

Put used trait imports field into a distinct query #45350

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

Merged
merged 4 commits into from
Oct 24, 2017

Conversation

cjkenn
Copy link
Contributor

@cjkenn cjkenn commented Oct 18, 2017

Implementation for #45214

r+ @nikomatsakis

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2017
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

This looks great! I left a few minor nits to adjust. Also, can you rebase and remove the merge commit?

/// This is used for warning unused imports.
pub used_trait_imports: DefIdSet,
/// This is used for warning unused imports. During type
/// checking, this field should not be cloned.
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to say a bit more here -- maybe:

"During type checker, this Rc should not be cloned: it must always have a ref-count of 1 so that we can insert things into the set mutably."

fn used_trait_imports<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId)
-> Rc<DefIdSet> {
Rc::clone(&tcx.typeck_tables_of(def_id).used_trait_imports)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just tcx.typeck_tables_of(def_id).used_trait_imports.clone()?

@cjkenn cjkenn force-pushed the cjkenn/used-trait-imports branch from b39e3bc to 6f30ce0 Compare October 20, 2017 06:22
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 23, 2017

📌 Commit 6f30ce0 has been approved by nikomatsakis

@kennytm kennytm 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 Oct 24, 2017
@bors
Copy link
Collaborator

bors commented Oct 24, 2017

⌛ Testing commit 6f30ce0 with merge 70504510d5b3ef7599e71806638d397b218aa726...

@kennytm
Copy link
Member

kennytm commented Oct 24, 2017

The dist-x86_64-linux Travis job was stuck in the "booting" state. I'm restarting the job now.

@bors
Copy link
Collaborator

bors commented Oct 24, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Oct 24, 2017

@bors retry

@bors
Copy link
Collaborator

bors commented Oct 24, 2017

⌛ Testing commit 6f30ce0 with merge 61af754...

bors added a commit that referenced this pull request Oct 24, 2017
Put used trait imports field into a distinct query

Implementation for #45214

r+ @nikomatsakis
@bors
Copy link
Collaborator

bors commented Oct 24, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 61af754 to master...

@bors bors merged commit 6f30ce0 into rust-lang:master Oct 24, 2017
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants