diff options
author | Jonas Schievink <[email protected]> | 2020-12-18 19:00:59 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-12-18 19:00:59 +0000 |
commit | d42d1d33f029ac09d4848c102b53ca39da6d0f4e (patch) | |
tree | 06ee47e00da116f5c64a094dc45e49bd0dd17b35 | |
parent | 08de1b4fa57ca78ad13026950b3eb024b7d2abf3 (diff) |
Fix parsing of active cfg_attr
-rw-r--r-- | crates/hir_def/src/attr.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index b8d9c2682..68d05c54d 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -167,6 +167,7 @@ impl RawAttrs { | |||
167 | }); | 167 | }); |
168 | cfg.pop(); // `,` ends up in here | 168 | cfg.pop(); // `,` ends up in here |
169 | 169 | ||
170 | let attr = Subtree { delimiter: None, token_trees: attr }; | ||
170 | let cfg = Subtree { delimiter: subtree.delimiter, token_trees: cfg }; | 171 | let cfg = Subtree { delimiter: subtree.delimiter, token_trees: cfg }; |
171 | let cfg = CfgExpr::parse(&cfg); | 172 | let cfg = CfgExpr::parse(&cfg); |
172 | 173 | ||
@@ -174,8 +175,7 @@ impl RawAttrs { | |||
174 | if cfg_options.check(&cfg) == Some(false) { | 175 | if cfg_options.check(&cfg) == Some(false) { |
175 | None | 176 | None |
176 | } else { | 177 | } else { |
177 | let attr = Subtree { delimiter: None, token_trees: attr }; | 178 | let attr = ast::Attr::parse(&format!("#[{}]", attr)).ok()?; |
178 | let attr = ast::Attr::parse(&attr.to_string()).ok()?; | ||
179 | let hygiene = Hygiene::new_unhygienic(); // FIXME | 179 | let hygiene = Hygiene::new_unhygienic(); // FIXME |
180 | Attr::from_src(attr, &hygiene) | 180 | Attr::from_src(attr, &hygiene) |
181 | } | 181 | } |