-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Conversation
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. |
There was a problem hiding this 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?
src/librustc/ty/context.rs
Outdated
/// 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. |
There was a problem hiding this comment.
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."
src/librustc_typeck/check/mod.rs
Outdated
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) |
There was a problem hiding this comment.
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()
?
b39e3bc
to
6f30ce0
Compare
@bors r+ |
📌 Commit 6f30ce0 has been approved by |
⌛ Testing commit 6f30ce0 with merge 70504510d5b3ef7599e71806638d397b218aa726... |
The |
💔 Test failed - status-travis |
@bors retry |
Put used trait imports field into a distinct query Implementation for #45214 r+ @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Implementation for #45214
r+ @nikomatsakis