diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-13 14:18:00 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-13 14:18:00 +0100 |
| commit | c4f6ef25d207ad0cff8d1e5282fedbe1e3ac743c (patch) | |
| tree | 22e2b3c744ec944c97ed0b6e6fd8654b9559af83 /src/libsyntax/parse | |
| parent | 75a369c5b11459baa6bf7734eeb6135998a0a7de (diff) | |
| download | rust-c4f6ef25d207ad0cff8d1e5282fedbe1e3ac743c.tar.gz rust-c4f6ef25d207ad0cff8d1e5282fedbe1e3ac743c.zip | |
remove extern_in_paths.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b90eeaca54b..e4b8866d7d2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1299,7 +1299,7 @@ impl<'a> Parser<'a> { fn token_is_bare_fn_keyword(&mut self) -> bool { self.check_keyword(keywords::Fn) || self.check_keyword(keywords::Unsafe) || - self.check_keyword(keywords::Extern) && self.is_extern_non_path() + self.check_keyword(keywords::Extern) } /// parse a `TyKind::BareFn` type: @@ -4605,10 +4605,6 @@ impl<'a> Parser<'a> { self.token.is_keyword(keywords::Crate) && self.look_ahead(1, |t| t != &token::ModSep) } - fn is_extern_non_path(&self) -> bool { - self.token.is_keyword(keywords::Extern) && self.look_ahead(1, |t| t != &token::ModSep) - } - fn is_existential_type_decl(&self) -> bool { self.token.is_keyword(keywords::Existential) && self.look_ahead(1, |t| t.is_keyword(keywords::Type)) @@ -4712,12 +4708,10 @@ impl<'a> Parser<'a> { // like a path (1 token), but it fact not a path. // `union::b::c` - path, `union U { ... }` - not a path. // `crate::b::c` - path, `crate struct S;` - not a path. - // `extern::b::c` - path, `extern crate c;` - not a path. } else if self.token.is_path_start() && !self.token.is_qpath_start() && !self.is_union_item() && !self.is_crate_vis() && - !self.is_extern_non_path() && !self.is_existential_type_decl() && !self.is_auto_trait_item() { let pth = self.parse_path(PathStyle::Expr)?; @@ -7113,8 +7107,7 @@ impl<'a> Parser<'a> { return Ok(Some(item)); } - if self.check_keyword(keywords::Extern) && self.is_extern_non_path() { - self.bump(); // `extern` + if self.eat_keyword(keywords::Extern) { if self.eat_keyword(keywords::Crate) { return Ok(Some(self.parse_item_extern_crate(lo, visibility, attrs)?)); } @@ -7623,7 +7616,7 @@ impl<'a> Parser<'a> { fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>, at_end: &mut bool) -> PResult<'a, Option<Mac>> { - if self.token.is_path_start() && !self.is_extern_non_path() { + if self.token.is_path_start() { let prev_span = self.prev_span; let lo = self.span; let pth = self.parse_path(PathStyle::Mod)?; |
