diff options
| author | bors <bors@rust-lang.org> | 2018-09-03 02:32:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-03 02:32:11 +0000 |
| commit | 2687112ea6a8701cbf36e6dd4d77d64694cf93d8 (patch) | |
| tree | a400a950c68e229a0b2e513238f510ee65f1da14 | |
| parent | 9395f0af789dc007e23dbae5d961c0751ab2dbe7 (diff) | |
| parent | 6aafd7adc6f882fcb1f9b60fd90ad5af9e391a0a (diff) | |
| download | rust-2687112ea6a8701cbf36e6dd4d77d64694cf93d8.tar.gz rust-2687112ea6a8701cbf36e6dd4d77d64694cf93d8.zip | |
Auto merge of #53838 - nrc:save-generic, r=eddyb
save-analysis: record info for the types in `where` clauses cc https://github.com/rust-lang-nursery/rls/issues/987 r? @eddyb
| -rw-r--r-- | src/librustc_save_analysis/dump_visitor.rs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 58665b808d9..adc63497daf 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1362,6 +1362,14 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } } } + + fn process_bounds(&mut self, bounds: &'l ast::GenericBounds) { + for bound in bounds { + if let ast::GenericBound::Trait(ref trait_ref, _) = *bound { + self.process_path(trait_ref.trait_ref.ref_id, &trait_ref.trait_ref.path) + } + } + } } impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll, O> { @@ -1527,20 +1535,19 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc fn visit_generics(&mut self, generics: &'l ast::Generics) { for param in &generics.params { - match param.kind { - ast::GenericParamKind::Lifetime { .. } => {} - ast::GenericParamKind::Type { ref default, .. } => { - for bound in ¶m.bounds { - if let ast::GenericBound::Trait(ref trait_ref, _) = *bound { - self.process_path(trait_ref.trait_ref.ref_id, &trait_ref.trait_ref.path) - } - } - if let Some(ref ty) = default { - self.visit_ty(&ty); - } + if let ast::GenericParamKind::Type { ref default, .. } = param.kind { + self.process_bounds(¶m.bounds); + if let Some(ref ty) = default { + self.visit_ty(&ty); } } } + for pred in &generics.where_clause.predicates { + if let ast::WherePredicate::BoundPredicate(ref wbp) = *pred { + self.process_bounds(&wbp.bounds); + self.visit_ty(&wbp.bounded_ty); + } + } } fn visit_ty(&mut self, t: &'l ast::Ty) { |
