diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-21 18:05:26 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-24 00:32:03 +0200 |
| commit | c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7 (patch) | |
| tree | cfb224137c513499e9dfc7dd49e3005b4ad6e47d /src/libsyntax/parse | |
| parent | 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1 (diff) | |
| download | rust-c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.tar.gz rust-c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.zip | |
pre-expansion gate associated_type_bounds
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser/path.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs index 639d61a2b5c..77709a22953 100644 --- a/src/libsyntax/parse/parser/path.rs +++ b/src/libsyntax/parse/parser/path.rs @@ -404,8 +404,9 @@ impl<'a> Parser<'a> { // Parse lifetime argument. args.push(GenericArg::Lifetime(self.expect_lifetime())); misplaced_assoc_ty_constraints.append(&mut assoc_ty_constraints); - } else if self.check_ident() && self.look_ahead(1, - |t| t == &token::Eq || t == &token::Colon) { + } else if self.check_ident() + && self.look_ahead(1, |t| t == &token::Eq || t == &token::Colon) + { // Parse associated type constraint. let lo = self.token.span; let ident = self.parse_ident()?; @@ -420,7 +421,14 @@ impl<'a> Parser<'a> { } else { unreachable!(); }; + let span = lo.to(self.prev_span); + + // Gate associated type bounds, e.g., `Iterator<Item: Ord>`. + if let AssocTyConstraintKind::Bound { .. } = kind { + self.sess.gated_spans.associated_type_bounds.borrow_mut().push(span); + } + constraints.push(AssocTyConstraint { id: ast::DUMMY_NODE_ID, ident, |
