Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode TraitAlias as if they were Trait #56616

Merged
merged 1 commit into from
Dec 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
};

Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/run-pass/traits/trait-alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// run-pass
#![feature(trait_alias)]

pub trait Foo {}
pub trait FooAlias = Foo;

fn main() {}