Auto merge of #40915 - nrc:save-assoc, r=eddyb
save-analysis: track associated types r? @eddyb
This commit is contained in:
commit
5309a3e31d
@ -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(_) => {}
|
||||
}
|
||||
}
|
||||
@ -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(_) => {}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#![ crate_name = "test" ]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
extern crate graphviz;
|
||||
// A simple rust project
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user