diff options
| author | varkor <github@varkor.com> | 2018-09-15 18:18:49 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-09-16 23:34:42 +0100 |
| commit | cb594cf3730c35fd6c514e98d9c7a0d78a00a02d (patch) | |
| tree | 4db20dec82d35c17b79cd49ef599cea3b42ac9f5 /src/libsyntax/parse | |
| parent | 90d36fb5905bbe5004f5b465ea14b53d10dae260 (diff) | |
| download | rust-cb594cf3730c35fd6c514e98d9c7a0d78a00a02d.tar.gz rust-cb594cf3730c35fd6c514e98d9c7a0d78a00a02d.zip | |
Treat `dyn` as a keyword in the 2018 edition
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f57fca2cfcf..ab1f46c4bb9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1562,8 +1562,9 @@ impl<'a> Parser<'a> { impl_dyn_multi = bounds.len() > 1 || self.prev_token_kind == PrevTokenKind::Plus; TyKind::ImplTrait(ast::DUMMY_NODE_ID, bounds) } else if self.check_keyword(keywords::Dyn) && - self.look_ahead(1, |t| t.can_begin_bound() && - !can_continue_type_after_non_fn_ident(t)) { + (self.span.edition() == Edition::Edition2018 || + self.look_ahead(1, |t| t.can_begin_bound() && + !can_continue_type_after_non_fn_ident(t))) { self.bump(); // `dyn` // Always parse bounds greedily for better error recovery. let bounds = self.parse_generic_bounds()?; diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 6e8014284ec..01bc7f6ad30 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -136,6 +136,7 @@ fn ident_can_begin_type(ident: ast::Ident, is_raw: bool) -> bool { keywords::Unsafe.name(), keywords::Extern.name(), keywords::Typeof.name(), + keywords::Dyn.name(), ].contains(&ident.name) } |
