From 75d62931280ae8f2ad26b2812e151f8f49de407a Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 11 May 2021 15:18:09 -0400 Subject: Re-add support for parsing (and pretty-printing) inner-attributes within body of a `match`. In other words, we can do `match EXPR { #![inner_attr] ARM_1 ARM_2 ... }` again. I believe this unbreaks the only four crates that crater flagged as broken by PR 83312. (I am putting this up so that the lang-team can check it out and decide whether it changes their mind about what to do regarding PR 83312.) --- compiler/rustc_parse/src/parser/expr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_parse/src/parser/expr.rs') diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 56c97b59476..2e16d850b53 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1947,7 +1947,7 @@ impl<'a> Parser<'a> { } /// Parses a `match ... { ... }` expression (`match` token already eaten). - fn parse_match_expr(&mut self, attrs: AttrVec) -> PResult<'a, P> { + fn parse_match_expr(&mut self, mut attrs: AttrVec) -> PResult<'a, P> { let match_span = self.prev_token.span; let lo = self.prev_token.span; let scrutinee = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; @@ -1962,6 +1962,7 @@ impl<'a> Parser<'a> { } return Err(e); } + attrs.extend(self.parse_inner_attributes()?); let mut arms: Vec = Vec::new(); while self.token != token::CloseDelim(token::Brace) { -- cgit 1.4.1-3-g733a5