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

Change opaque type syntax from existential type to type alias impl Trait #63180

Merged
merged 10 commits into from
Aug 3, 2019
6 changes: 3 additions & 3 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub(crate) enum Target {
ForeignMod,
GlobalAsm,
Ty,
Existential,
OpaqueTy,
varkor marked this conversation as resolved.
Show resolved Hide resolved
Enum,
Struct,
Union,
Expand All @@ -51,7 +51,7 @@ impl Display for Target {
Target::ForeignMod => "foreign module",
Target::GlobalAsm => "global asm",
Target::Ty => "type alias",
Target::Existential => "existential type",
Target::OpaqueTy => "opaque type",
Target::Enum => "enum",
Target::Struct => "struct",
Target::Union => "union",
Expand All @@ -76,7 +76,7 @@ impl Target {
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
hir::ItemKind::GlobalAsm(..) => Target::GlobalAsm,
hir::ItemKind::Ty(..) => Target::Ty,
hir::ItemKind::Existential(..) => Target::Existential,
hir::ItemKind::OpaqueTy(..) => Target::OpaqueTy,
hir::ItemKind::Enum(..) => Target::Enum,
hir::ItemKind::Struct(..) => Target::Struct,
hir::ItemKind::Union(..) => Target::Union,
Expand Down
16 changes: 8 additions & 8 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ pub enum DefKind {
/// Refers to the variant itself, `DefKind::Ctor` refers to its constructor if it exists.
Variant,
Trait,
/// `existential type Foo: Bar;`
Existential,
/// `type Foo = impl Bar;`
OpaqueTy,
/// `type Foo = Bar;`
TyAlias,
ForeignTy,
TraitAlias,
AssocTy,
/// `existential type Foo: Bar;`
AssocExistential,
/// `type Foo = impl Bar;`
AssocOpaqueTy,
TyParam,

// Value namespace
Expand Down Expand Up @@ -96,11 +96,11 @@ impl DefKind {
DefKind::Ctor(CtorOf::Struct, CtorKind::Const) => "unit struct",
DefKind::Ctor(CtorOf::Struct, CtorKind::Fictive) =>
bug!("impossible struct constructor"),
DefKind::Existential => "existential type",
DefKind::OpaqueTy => "opaque type",
DefKind::TyAlias => "type alias",
DefKind::TraitAlias => "trait alias",
DefKind::AssocTy => "associated type",
DefKind::AssocExistential => "associated existential type",
DefKind::AssocOpaqueTy => "associated opaque type",
DefKind::Union => "union",
DefKind::Trait => "trait",
DefKind::ForeignTy => "foreign type",
Expand All @@ -118,9 +118,9 @@ impl DefKind {
match *self {
DefKind::AssocTy
| DefKind::AssocConst
| DefKind::AssocExistential
| DefKind::AssocOpaqueTy
| DefKind::Enum
| DefKind::Existential => "an",
| DefKind::OpaqueTy => "an",
DefKind::Macro(macro_kind) => macro_kind.article(),
_ => "a",
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_ty(ty);
visitor.visit_generics(generics)
}
ItemKind::Existential(ExistTy {
ItemKind::OpaqueTy(OpaqueTy {
ref generics,
ref bounds,
..
Expand Down Expand Up @@ -930,7 +930,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
visitor.visit_id(impl_item.hir_id);
visitor.visit_ty(ty);
}
ImplItemKind::Existential(ref bounds) => {
ImplItemKind::OpaqueTy(ref bounds) => {
visitor.visit_id(impl_item.hir_id);
walk_list!(visitor, visit_param_bound, bounds);
}
Expand Down
Loading