From bd07165690481aaa4c99b9c3ab6e20fbebae8f54 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 24 Jan 2021 16:41:12 +0300 Subject: parser: Collect tokens for values in key-value attributes --- compiler/rustc_parse/src/parser/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'compiler/rustc_parse/src') diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index f11c6591de9..c575c821964 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -980,12 +980,8 @@ impl<'a> Parser<'a> { } } - // The value here is never passed to macros as tokens by itself (not as a part - // of the whole attribute), so we don't collect tokens here. If this changes, - // then token will need to be collected. One catch here is that we are using - // a nonterminal for keeping the expression, but this nonterminal should not - // be wrapped into a group when converting to token stream. - let expr = self.parse_expr()?; + // Collect tokens because they are used during lowering to HIR. + let expr = self.collect_tokens(|this| this.parse_expr())?; let span = expr.span; match &expr.kind { -- cgit 1.4.1-3-g733a5