diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-11-08 20:26:59 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-11-16 13:57:46 -0500 |
| commit | 29a39ab8346721cf60cfb15f7e025eb24efc818f (patch) | |
| tree | d3a79ce81fb142dfca210fed922727e40cc4d1eb /src | |
| parent | 4a4c61b2d2b99e2ae20ab5fcf7c1c59a9ac7d226 (diff) | |
| download | rust-29a39ab8346721cf60cfb15f7e025eb24efc818f.tar.gz rust-29a39ab8346721cf60cfb15f7e025eb24efc818f.zip | |
move `convert_impl_item` into the main loop
This is better because the edges will be accounted to the impl item itself
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/collect.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index e7873d2f818..fc197742455 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -151,7 +151,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CollectItemTypesVisitor<'a, 'tcx> { } fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) { - // handled in `visit_item` above; we may want to break this out later + convert_impl_item(self.ccx, impl_item); intravisit::walk_impl_item(self, impl_item); } } @@ -792,10 +792,6 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) { } } } - - for &impl_item_id in impl_item_ids { - convert_impl_item(ccx, impl_item_id); - } }, hir::ItemTrait(.., ref trait_items) => { let trait_def = trait_def_of_item(ccx, it); @@ -881,10 +877,12 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) { } } -fn convert_impl_item(ccx: &CrateCtxt, impl_item_id: hir::ImplItemId) { +fn convert_impl_item(ccx: &CrateCtxt, impl_item: &hir::ImplItem) { let tcx = ccx.tcx; - let impl_item = tcx.map.impl_item(impl_item_id); - let impl_def_id = tcx.map.get_parent_did(impl_item_id.id); + + // we can lookup details about the impl because items are visited + // before impl-items + let impl_def_id = tcx.map.get_parent_did(impl_item.id); let impl_predicates = tcx.item_predicates(impl_def_id); let impl_trait_ref = tcx.impl_trait_ref(impl_def_id); let impl_self_ty = tcx.item_type(impl_def_id); |
