diff options
| author | bors <bors@rust-lang.org> | 2020-10-24 19:23:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-24 19:23:32 +0000 |
| commit | ffa2e7ae8fbf9badc035740db949b9dae271c29f (patch) | |
| tree | 828c3a5e26b4b35d40aa7cd43ecabcf972892c89 /compiler/rustc_parse/src/parser/item.rs | |
| parent | 89fdb30892dbe330730ad1a1c1fe45b9046c2973 (diff) | |
| parent | 5c7d8d049c88fe58fb4cf67f47e69ad5e6995e28 (diff) | |
Auto merge of #77255 - Aaron1011:feature/collect-attr-tokens, r=petrochenkov
Unconditionally capture tokens for attributes. This allows us to avoid synthesizing tokens in `prepend_attr`, since we have the original tokens available. We still need to synthesize tokens when expanding `cfg_attr`, but this is an unavoidable consequence of the syntax of `cfg_attr` - the user does not supply the `#` and `[]` tokens that a `cfg_attr` expands to. This is based on PR https://github.com/rust-lang/rust/pull/77250 - this PR exposes a bug in the current `collect_tokens` implementation, which is fixed by the rewrite.
Diffstat (limited to 'compiler/rustc_parse/src/parser/item.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 4ad259715bd..e57a2e42b5d 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -151,7 +151,7 @@ impl<'a> Parser<'a> { if let Some(tokens) = tokens { if let Some(item) = &mut item { if !item.attrs.iter().any(|attr| attr.style == AttrStyle::Inner) { - item.tokens = Some(tokens); + item.tokens = tokens; } } } |
