]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/parse/parser/path.rs
Rollup merge of #65792 - Centril:split-syntax-2, r=petrochenkov
[rust.git] / src / libsyntax / parse / parser / path.rs
index 639d61a2b5cd4a90b27eb5092af4521b2b92c1cf..38a28224daba44d5c028aed686a5421f92e38f56 100644 (file)
@@ -130,7 +130,7 @@ fn parse_path_allowing_meta(&mut self, style: PathStyle) -> PResult<'a, Path> {
     }
 
     /// Parse a list of paths inside `#[derive(path_0, ..., path_n)]`.
-    crate fn parse_derive_paths(&mut self) -> PResult<'a, Vec<Path>> {
+    pub fn parse_derive_paths(&mut self) -> PResult<'a, Vec<Path>> {
         self.expect(&token::OpenDelim(token::Paren))?;
         let mut list = Vec::new();
         while !self.eat(&token::CloseDelim(token::Paren)) {
@@ -404,8 +404,9 @@ fn parse_generic_args(&mut self) -> PResult<'a, (Vec<GenericArg>, Vec<AssocTyCon
                 // 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 @@ fn parse_generic_args(&mut self) -> PResult<'a, (Vec<GenericArg>, Vec<AssocTyCon
                 } 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,