about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-07-30 00:11:50 +0100
committervarkor <github@varkor.com>2019-08-02 02:44:35 +0100
commit87738fe83401ee2a7d2556df8db0df4dec7cd58d (patch)
treeca3df813aadf190c78f292eb752d4322bdd32205 /src/libsyntax/parse
parent435236b8877cdb98c82eaebfb7887782277265c5 (diff)
downloadrust-87738fe83401ee2a7d2556df8db0df4dec7cd58d.tar.gz
rust-87738fe83401ee2a7d2556df8db0df4dec7cd58d.zip
Switch existential_type to type_alias_impl_trait
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7096d6799e2..ec95a2090d6 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -6805,40 +6805,29 @@ impl<'a> Parser<'a> {
         Ok(self.mk_item(lo.to(prev_span), invalid, ItemKind::ForeignMod(m), visibility, attrs))
     }
 
-    /// Parses `type Foo = Bar;`
-    /// or
-    /// `existential type Foo: Bar;`
-    /// or
-    /// `return `None``
+    /// Parses `type Foo = Bar;` or returns `None`
     /// without modifying the parser state.
     fn eat_type(&mut self) -> Option<PResult<'a, (Ident, AliasKind, ast::Generics)>> {
         // This parses the grammar:
         //     Ident ["<"...">"] ["where" ...] ("=" | ":") Ty ";"
-        if self.check_keyword(kw::Type) ||
-           self.check_keyword(kw::Existential) &&
-                self.is_keyword_ahead(1, &[kw::Type]) {
-            let existential = self.eat_keyword(kw::Existential);
-            assert!(self.eat_keyword(kw::Type));
-            Some(self.parse_existential_or_alias(existential))
+        if self.eat_keyword(kw::Type) {
+            Some(self.parse_type_alias())
         } else {
             None
         }
     }
 
     /// Parses a type alias or existential type.
-    fn parse_existential_or_alias(
-        &mut self,
-        existential: bool,
-    ) -> PResult<'a, (Ident, AliasKind, ast::Generics)> {
+    fn parse_type_alias(&mut self) -> PResult<'a, (Ident, AliasKind, ast::Generics)> {
         let ident = self.parse_ident()?;
         let mut tps = self.parse_generics()?;
         tps.where_clause = self.parse_where_clause()?;
-        let alias = if existential {
-            self.expect(&token::Colon)?;
+        self.expect(&token::Eq)?;
+        let alias = if self.check_keyword(kw::Impl) {
+            self.bump();
             let bounds = self.parse_generic_bounds(Some(self.prev_span))?;
             AliasKind::Existential(bounds)
         } else {
-            self.expect(&token::Eq)?;
             let ty = self.parse_ty()?;
             AliasKind::Weak(ty)
         };