Skip to content

Commit 6aafd7a

Browse files
committed
save-analysis: record info for the types in where clauses
cc rust-lang/rls#987
1 parent f8d3459 commit 6aafd7a

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/librustc_save_analysis/dump_visitor.rs

+18-11
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,14 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
13621362
}
13631363
}
13641364
}
1365+
1366+
fn process_bounds(&mut self, bounds: &'l ast::GenericBounds) {
1367+
for bound in bounds {
1368+
if let ast::GenericBound::Trait(ref trait_ref, _) = *bound {
1369+
self.process_path(trait_ref.trait_ref.ref_id, &trait_ref.trait_ref.path)
1370+
}
1371+
}
1372+
}
13651373
}
13661374

13671375
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
15271535

15281536
fn visit_generics(&mut self, generics: &'l ast::Generics) {
15291537
for param in &generics.params {
1530-
match param.kind {
1531-
ast::GenericParamKind::Lifetime { .. } => {}
1532-
ast::GenericParamKind::Type { ref default, .. } => {
1533-
for bound in &param.bounds {
1534-
if let ast::GenericBound::Trait(ref trait_ref, _) = *bound {
1535-
self.process_path(trait_ref.trait_ref.ref_id, &trait_ref.trait_ref.path)
1536-
}
1537-
}
1538-
if let Some(ref ty) = default {
1539-
self.visit_ty(&ty);
1540-
}
1538+
if let ast::GenericParamKind::Type { ref default, .. } = param.kind {
1539+
self.process_bounds(&param.bounds);
1540+
if let Some(ref ty) = default {
1541+
self.visit_ty(&ty);
15411542
}
15421543
}
15431544
}
1545+
for pred in &generics.where_clause.predicates {
1546+
if let ast::WherePredicate::BoundPredicate(ref wbp) = *pred {
1547+
self.process_bounds(&wbp.bounds);
1548+
self.visit_ty(&wbp.bounded_ty);
1549+
}
1550+
}
15441551
}
15451552

15461553
fn visit_ty(&mut self, t: &'l ast::Ty) {

0 commit comments

Comments
 (0)