Retire ast::TyAliasWhereClauses.

This commit is contained in:
Camille Gillot
2025-10-15 04:04:36 +00:00
parent 1d23d06800
commit 15c91bf308
12 changed files with 170 additions and 158 deletions

View File

@@ -1041,40 +1041,19 @@ impl<'a> Parser<'a> {
// Parse optional colon and param bounds.
let bounds = if self.eat(exp!(Colon)) { self.parse_generic_bounds()? } else { Vec::new() };
let before_where_clause = self.parse_where_clause()?;
generics.where_clause = self.parse_where_clause()?;
let ty = if self.eat(exp!(Eq)) { Some(self.parse_ty()?) } else { None };
let after_where_clause = self.parse_where_clause()?;
let where_clauses = TyAliasWhereClauses {
before: TyAliasWhereClause {
has_where_token: before_where_clause.has_where_token,
span: before_where_clause.span,
},
after: TyAliasWhereClause {
has_where_token: after_where_clause.has_where_token,
span: after_where_clause.span,
},
split: before_where_clause.predicates.len(),
};
let mut predicates = before_where_clause.predicates;
predicates.extend(after_where_clause.predicates);
let where_clause = WhereClause {
has_where_token: before_where_clause.has_where_token
|| after_where_clause.has_where_token,
predicates,
span: DUMMY_SP,
};
generics.where_clause = where_clause;
self.expect_semi()?;
Ok(ItemKind::TyAlias(Box::new(TyAlias {
defaultness,
ident,
generics,
where_clauses,
after_where_clause,
bounds,
ty,
})))