From cb594cf3730c35fd6c514e98d9c7a0d78a00a02d Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 15 Sep 2018 18:18:49 +0100 Subject: Treat `dyn` as a keyword in the 2018 edition --- src/libsyntax/parse/parser.rs | 5 +++-- src/libsyntax/parse/token.rs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/parse') 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) } -- cgit 1.4.1-3-g733a5