about summary refs log tree commit diff
path: root/src/test/ui/proc-macro/attribute-after-derive.stdout
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-192/+0
2021-12-01Pretty print empty blocks as {}David Tolnay-2/+2
2021-09-24Stabilize `feature(macro_attributes_in_derive_output)`Vadim Petrochenkov-38/+38
2021-09-24builtin_macros: Make #[derive(A, B, ...)] cfg-eval its input only for `A, B, ↵Vadim Petrochenkov-2/+46
...`
2021-04-11Implement token-based handling of attributes during expansionAaron Hill-12/+12
This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2021-04-10Expand derive invocations in left-to-right orderAaron Hill-16/+16
While derives were being collected in left-to-order order, the corresponding `Invocation`s were being pushed in the wrong order.
2021-02-07Feature gate macro attributes in `#[derive]` outputVadim Petrochenkov-29/+29
2021-02-07expand/resolve: Turn `#[derive]` into a regular macro attributeVadim Petrochenkov-0/+148