about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-09-22 09:56:27 +0200
committerGitHub <noreply@github.com>2018-09-22 09:56:27 +0200
commit822c51121e7379ad72c2a2ccfed3443ecc40fbf4 (patch)
treec8bfbe482b6e2af917d6dfad6872bf2c45f15b65 /src/libsyntax/parse/parser.rs
parente6ee4e056d7855cb0353efbb4207dceb9ab46414 (diff)
parentcb594cf3730c35fd6c514e98d9c7a0d78a00a02d (diff)
downloadrust-822c51121e7379ad72c2a2ccfed3443ecc40fbf4.tar.gz
rust-822c51121e7379ad72c2a2ccfed3443ecc40fbf4.zip
Rollup merge of #54261 - varkor:dyn-keyword-2018, r=petrochenkov
Make `dyn` a keyword in the 2018 edition

Proposed in https://github.com/rust-lang/rust/issues/44662#issuecomment-421596088.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 6ec1ad969ee..f7af8a3c34c 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1578,8 +1578,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()?;