| 1507 | self.advance(); |
| 1508 | let parsed = (|| -> Result<Vec<Type>, ParserError> { |
| 1509 | let mut args = Vec::new(); |
| 1510 | loop { |
| 1511 | args.push(self.parse_type()?); |
| 1512 | if self.match_comma() { |
| 1513 | continue; |
| 1514 | } |
| 1515 | break; |
| 1516 | } |
| 1517 | self.expect_generic_close()?; |
| 1518 | if !self.check_lbrace() { |
| 1519 | return Err(self.error("expected `{` after struct type arguments")); |
| 1520 | } |
| 1521 | Ok(args) |
| 1522 | })(); |
| 1523 | |
| 1524 | if let Ok(args) = parsed { |
| 1525 | Some(args) |
| 1526 | } else { |
| 1527 | self.pos = saved_pos; |
| 1528 | self.pending_gt_from_shr = saved_pending_gt; |
| 1529 | None |
| 1530 | } |
| 1531 | } |
| 1532 | |
| 1533 | // `Owner<args>.MEMBER`: an associated-constant projection in expression |
| 1534 | // position. Backtracks (like call type arguments) when the shape mismatches. |
| 1535 | fn try_parse_associated_member(&mut self) -> Option<(Vec<Type>, String)> { |
| 1536 | if self.peek() != Some(&Token::Lt) { |