Change how parse_expr_force_collect works.
It now parses outer attributes before collecting tokens. This avoids the problem where the outer attribute tokens were being stored twice -- for the attribute tokesn, and also for the expression tokens. Fixes #86055.
This commit is contained in:
@@ -98,9 +98,12 @@ impl<'a> Parser<'a> {
|
||||
self.parse_expr_res(Restrictions::empty(), attrs)
|
||||
}
|
||||
|
||||
/// Parses an expression, forcing tokens to be collected
|
||||
/// Parses an expression, forcing tokens to be collected.
|
||||
pub fn parse_expr_force_collect(&mut self) -> PResult<'a, P<Expr>> {
|
||||
self.collect_tokens_no_attrs(|this| this.parse_expr())
|
||||
self.current_closure.take();
|
||||
|
||||
let attrs = self.parse_outer_attributes()?;
|
||||
self.collect_tokens_no_attrs(|this| this.parse_expr_res(Restrictions::empty(), attrs))
|
||||
}
|
||||
|
||||
pub fn parse_expr_anon_const(&mut self) -> PResult<'a, AnonConst> {
|
||||
|
||||
Reference in New Issue
Block a user