On-demandify associated item retrieval#40668
Merged
bors merged 2 commits intorust-lang:masterfrom Mar 23, 2017
Merged
Conversation
| hir::ItemImpl(.., ref impl_trait_ref, _, ref impl_item_refs) => { | ||
| for impl_item_ref in impl_item_refs { | ||
| let assoc_item = | ||
| tcx.associated_item_from_impl_item_ref(parent_def_id, |
Contributor
There was a problem hiding this comment.
This looks basically right. I would probably rewrite this for loop (and the one below) to something like:
if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.node_id == id) {
return tcx.associated_item_from_impl_item_ref(...); // same parameters you have already
}
Contributor
There was a problem hiding this comment.
maybe with an assert! that assoc_item.def_id == def_id at the end =)
6 tasks
eddyb
reviewed
Mar 21, 2017
| } | ||
| } | ||
|
|
||
| fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) |
Member
There was a problem hiding this comment.
I think this should be in rustc::hir, including associated_item_from_{impl,trait}_item_ref.
Contributor
There was a problem hiding this comment.
I opened up #40697 where we can discuss the precise plan. It feels a bit like this should go into a follow-up PR to me; this PR is just converting to on-demand but keeping the existing structure.
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 8e58d9e has been approved by |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
Mar 23, 2017
…atsakis On-demandify associated item retrieval Part of rust-lang#40614. I also started converting `adt_def`, but I decided to open a PR with just this bit first to make sure I'm going about this correctly. r? @nikomatsakis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #40614.
I also started converting
adt_def, but I decided to open a PR with just this bit first to make sure I'm going about this correctly.r? @nikomatsakis