Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c7cba3d

Browse files
committedJul 19, 2018
Auto merge of #52024 - oli-obk:existential_parse, r=nikomatsakis
Implement existential types (not for associated types yet) r? @nikomatsakis cc @Centril @varkor @alexreg
2 parents 11864c4 + 9017f79 commit c7cba3d

File tree

216 files changed

+2028
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+2028
-146
lines changed
 

‎src/librustc/hir/def.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ pub enum Def {
3737
Enum(DefId),
3838
Variant(DefId),
3939
Trait(DefId),
40+
/// `existential type Foo: Bar;`
4041
Existential(DefId),
42+
/// `type Foo = Bar;`
4143
TyAlias(DefId),
4244
TyForeign(DefId),
4345
TraitAlias(DefId),
4446
AssociatedTy(DefId),
47+
/// `existential type Foo: Bar;`
48+
AssociatedExistential(DefId),
4549
PrimTy(hir::PrimTy),
4650
TyParam(DefId),
4751
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
@@ -245,7 +249,7 @@ impl Def {
245249
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
246250
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
247251
Def::AssociatedConst(id) | Def::Macro(id, ..) |
248-
Def::Existential(id) |
252+
Def::Existential(id) | Def::AssociatedExistential(id) |
249253
Def::GlobalAsm(id) | Def::TyForeign(id) => {
250254
id
251255
}
@@ -276,6 +280,7 @@ impl Def {
276280
Def::TyAlias(..) => "type alias",
277281
Def::TraitAlias(..) => "trait alias",
278282
Def::AssociatedTy(..) => "associated type",
283+
Def::AssociatedExistential(..) => "associated existential type",
279284
Def::Struct(..) => "struct",
280285
Def::StructCtor(.., CtorKind::Fn) => "tuple struct",
281286
Def::StructCtor(.., CtorKind::Const) => "unit struct",

‎src/librustc/hir/intravisit.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,10 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
907907
visitor.visit_id(impl_item.id);
908908
visitor.visit_ty(ty);
909909
}
910+
ImplItemKind::Existential(ref bounds) => {
911+
visitor.visit_id(impl_item.id);
912+
walk_list!(visitor, visit_param_bound, bounds);
913+
}
910914
}
911915
}
912916

0 commit comments

Comments
 (0)
Please sign in to comment.