Skip to content

Commit 46dc7c5

Browse files
committed
stub out trait aliases in save_analysis
1 parent f1c4a92 commit 46dc7c5

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
285285
HirDef::Enum(..) |
286286
HirDef::TyAlias(..) |
287287
HirDef::TyForeign(..) |
288+
HirDef::TraitAlias(..) |
288289
HirDef::Trait(_) => {
289290
let span = self.span_from_span(sub_span.expect("No span found for type ref"));
290291
self.dumper.dump_ref(Ref {

src/librustc_save_analysis/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
721721
HirDef::Enum(def_id) |
722722
HirDef::TyAlias(def_id) |
723723
HirDef::TyForeign(def_id) |
724+
HirDef::TraitAlias(def_id) |
724725
HirDef::AssociatedTy(def_id) |
725726
HirDef::Trait(def_id) |
726727
HirDef::TyParam(def_id) => {

src/librustc_save_analysis/sig.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,25 @@ impl Sig for ast::Item {
487487

488488
Ok(sig)
489489
}
490+
ast::ItemKind::TraitAlias(ref generics, ref bounds) => {
491+
let mut text = String::new();
492+
text.push_str("trait ");
493+
let mut sig = name_and_generics(text,
494+
offset,
495+
generics,
496+
self.id,
497+
self.ident,
498+
scx)?;
499+
500+
if !bounds.is_empty() {
501+
sig.text.push_str(" = ");
502+
sig.text.push_str(&pprust::bounds_to_string(bounds));
503+
}
504+
// FIXME where clause
505+
sig.text.push_str(";");
506+
507+
Ok(sig)
508+
}
490509
ast::ItemKind::AutoImpl(unsafety, ref trait_ref) => {
491510
let mut text = String::new();
492511
if unsafety == ast::Unsafety::Unsafe {

0 commit comments

Comments
 (0)