about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorDustin Speckhals <dustin1114@gmail.com>2017-10-29 13:27:06 -0400
committerDustin Speckhals <dustin1114@gmail.com>2017-10-29 13:27:06 -0400
commitd284815f72f20c1edcf05066b376b45ed5390b4e (patch)
treefb285b071a84ebe84d856eb004088f683e94eb82 /src/libsyntax/parse
parent1156455d4278b2d19910b0e198dfcc4560eadcb7 (diff)
parent7d475a28dfa5399600c9b4121193fa57786ab88b (diff)
downloadrust-d284815f72f20c1edcf05066b376b45ed5390b4e.tar.gz
rust-d284815f72f20c1edcf05066b376b45ed5390b4e.zip
Merge branch 'master' into rustfmt-update
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e96a5417aff..a3a265450ab 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5687,6 +5687,24 @@ impl<'a> Parser<'a> {
         })
     }
 
+    /// Parse a type from a foreign module
+    fn parse_item_foreign_type(&mut self, vis: ast::Visibility, lo: Span, attrs: Vec<Attribute>)
+                             -> PResult<'a, ForeignItem> {
+        self.expect_keyword(keywords::Type)?;
+
+        let ident = self.parse_ident()?;
+        let hi = self.span;
+        self.expect(&token::Semi)?;
+        Ok(ast::ForeignItem {
+            ident: ident,
+            attrs: attrs,
+            node: ForeignItemKind::Ty,
+            id: ast::DUMMY_NODE_ID,
+            span: lo.to(hi),
+            vis: vis
+        })
+    }
+
     /// Parse extern crate links
     ///
     /// # Examples
@@ -6161,6 +6179,10 @@ impl<'a> Parser<'a> {
         if self.check_keyword(keywords::Fn) {
             return Ok(Some(self.parse_item_foreign_fn(visibility, lo, attrs)?));
         }
+        // FOREIGN TYPE ITEM
+        if self.check_keyword(keywords::Type) {
+            return Ok(Some(self.parse_item_foreign_type(visibility, lo, attrs)?));
+        }
 
         // FIXME #5668: this will occur for a macro invocation:
         match self.parse_macro_use_or_failure(attrs, true, false, lo, visibility)? {