<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/test/ui/proc-macro/attribute-after-derive.stdout, branch 1.53.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.53.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.53.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2021-04-11T05:31:36+00:00</updated>
<entry>
<title>Implement token-based handling of attributes during expansion</title>
<updated>2021-04-11T05:31:36+00:00</updated>
<author>
<name>Aaron Hill</name>
<email>aa1ronham@gmail.com</email>
</author>
<published>2020-11-28T23:33:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a93c4f05de5c5cdd8158e23de7c3cf86a548447f'/>
<id>urn:sha1:a93c4f05de5c5cdd8158e23de7c3cf86a548447f</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Expand derive invocations in left-to-right order</title>
<updated>2021-04-10T21:29:20+00:00</updated>
<author>
<name>Aaron Hill</name>
<email>aa1ronham@gmail.com</email>
</author>
<published>2021-04-09T01:35:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=21e6cc19fe3740d4e8d45866b053e774fc010209'/>
<id>urn:sha1:21e6cc19fe3740d4e8d45866b053e774fc010209</id>
<content type='text'>
While derives were being collected in left-to-order order, the
corresponding `Invocation`s were being pushed in the wrong order.
</content>
</entry>
<entry>
<title>Feature gate macro attributes in `#[derive]` output</title>
<updated>2021-02-07T17:08:45+00:00</updated>
<author>
<name>Vadim Petrochenkov</name>
<email>vadim.petrochenkov@gmail.com</email>
</author>
<published>2021-01-17T13:05:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f6caae52c1622a3c4f154eadaad615b577ceb6a8'/>
<id>urn:sha1:f6caae52c1622a3c4f154eadaad615b577ceb6a8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>expand/resolve: Turn `#[derive]` into a regular macro attribute</title>
<updated>2021-02-07T17:08:45+00:00</updated>
<author>
<name>Vadim Petrochenkov</name>
<email>vadim.petrochenkov@gmail.com</email>
</author>
<published>2020-11-14T11:47:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=dbdbd30bf2cb0d48c8bbce83c2458592664dbb18'/>
<id>urn:sha1:dbdbd30bf2cb0d48c8bbce83c2458592664dbb18</id>
<content type='text'>
</content>
</entry>
</feed>
