Skip to content

Commit

Permalink
stub out trait aliases in save_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
durka committed Dec 14, 2017
1 parent f1c4a92 commit 46dc7c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_save_analysis/dump_visitor.rs
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_save_analysis/lib.rs
Expand Up @@ -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) => {
Expand Down
19 changes: 19 additions & 0 deletions src/librustc_save_analysis/sig.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 46dc7c5

Please sign in to comment.