Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,32 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
&trait_item.attrs,
trait_item.span);
}
ast::TraitItemKind::Const(_, None) |
ast::TraitItemKind::Type(..) |
ast::TraitItemKind::Type(ref _bounds, ref default_ty) => {
// FIXME do something with _bounds (for type refs)
let name = trait_item.ident.name.to_string();
let qualname = format!("::{}", self.tcx.node_path_str(trait_item.id));
let sub_span = self.span.sub_span_after_keyword(trait_item.span, keywords::Type);

if !self.span.filter_generated(sub_span, trait_item.span) {
self.dumper.typedef(TypeDefData {
span: sub_span.expect("No span found for assoc type"),
name: name,
id: trait_item.id,
qualname: qualname,
value: self.span.snippet(trait_item.span),
visibility: Visibility::Public,
parent: Some(trait_id),
docs: docs_for_attrs(&trait_item.attrs),
sig: None,
attributes: trait_item.attrs.clone(),
}.lower(self.tcx));
}

if let &Some(ref default_ty) = default_ty {
self.visit_ty(default_ty)
}
}
ast::TraitItemKind::Const(ref ty, None) => self.visit_ty(ty),
ast::TraitItemKind::Macro(_) => {}
}
}
Expand All @@ -1177,7 +1201,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
&impl_item.attrs,
impl_item.span);
}
ast::ImplItemKind::Type(_) |
ast::ImplItemKind::Type(ref ty) => self.visit_ty(ty),
ast::ImplItemKind::Macro(_) => {}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/test/run-make/save-analysis/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![ crate_name = "test" ]
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(associated_type_defaults)]

extern crate graphviz;
// A simple rust project
Expand Down Expand Up @@ -441,3 +442,19 @@ fn test_format_args() {
print!("{0} + {} = {}", x, y);
print!("x is {}, y is {1}, name is {n}", x, y, n = name);
}

struct FrameBuffer;

struct SilenceGenerator;

impl Iterator for SilenceGenerator {
type Item = FrameBuffer;

fn next(&mut self) -> Option<Self::Item> {
panic!();
}
}

trait Foo {
type Bar = FrameBuffer;
}