stub out trait aliases in save_analysis

This commit is contained in:
Alex Burka 2017-10-02 13:49:11 +00:00 committed by Alex Burka
parent f1c4a922fe
commit 46dc7c59de
3 changed files with 21 additions and 0 deletions

View File

@ -285,6 +285,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
HirDef::Enum(..) |
HirDef::TyAlias(..) |
HirDef::TyForeign(..) |
HirDef::TraitAlias(..) |
HirDef::Trait(_) => {
let span = self.span_from_span(sub_span.expect("No span found for type ref"));
self.dumper.dump_ref(Ref {

View File

@ -721,6 +721,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
HirDef::Enum(def_id) |
HirDef::TyAlias(def_id) |
HirDef::TyForeign(def_id) |
HirDef::TraitAlias(def_id) |
HirDef::AssociatedTy(def_id) |
HirDef::Trait(def_id) |
HirDef::TyParam(def_id) => {

View File

@ -487,6 +487,25 @@ impl Sig for ast::Item {
Ok(sig)
}
ast::ItemKind::TraitAlias(ref generics, ref bounds) => {
let mut text = String::new();
text.push_str("trait ");
let mut sig = name_and_generics(text,
offset,
generics,
self.id,
self.ident,
scx)?;
if !bounds.is_empty() {
sig.text.push_str(" = ");
sig.text.push_str(&pprust::bounds_to_string(bounds));
}
// FIXME where clause
sig.text.push_str(";");
Ok(sig)
}
ast::ItemKind::AutoImpl(unsafety, ref trait_ref) => {
let mut text = String::new();
if unsafety == ast::Unsafety::Unsafe {