From 14cca296c5f4e12b147a60bfca032950cc67e635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 7 Dec 2018 14:52:44 -0800 Subject: [PATCH] Encode `TraitAlias` as if they were `Trait` --- src/librustc_metadata/encoder.rs | 4 ++-- src/test/ui/run-pass/traits/trait-alias.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/run-pass/traits/trait-alias.rs diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 2736c60ffb6fa..9bcb541ece8b5 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1141,7 +1141,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { EntryKind::Impl(self.lazy(&data)) } - hir::ItemKind::Trait(..) => { + hir::ItemKind::Trait(..) | + hir::ItemKind::TraitAlias(..) => { let trait_def = tcx.trait_def(def_id); let data = TraitData { unsafety: trait_def.unsafety, @@ -1154,7 +1155,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { EntryKind::Trait(self.lazy(&data)) } hir::ItemKind::ExternCrate(_) | - hir::ItemKind::TraitAlias(..) | hir::ItemKind::Use(..) => bug!("cannot encode info for item {:?}", item), }; diff --git a/src/test/ui/run-pass/traits/trait-alias.rs b/src/test/ui/run-pass/traits/trait-alias.rs new file mode 100644 index 0000000000000..9be5664869e05 --- /dev/null +++ b/src/test/ui/run-pass/traits/trait-alias.rs @@ -0,0 +1,7 @@ +// run-pass +#![feature(trait_alias)] + +pub trait Foo {} +pub trait FooAlias = Foo; + +fn main() {}