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() {}