<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_expand/src/parse/tests.rs, branch 1.68.2</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.68.2</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.68.2'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2023-01-17T07:48:19+00:00</updated>
<entry>
<title>`rustc_expand`: remove `ref` patterns</title>
<updated>2023-01-17T07:48:19+00:00</updated>
<author>
<name>Maybe Waffle</name>
<email>waffle.lapkin@gmail.com</email>
</author>
<published>2022-12-23T17:34:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=bddbf38af29dcfe5ebe12efebf465233fbb52398'/>
<id>urn:sha1:bddbf38af29dcfe5ebe12efebf465233fbb52398</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Split `MacArgs` in two.</title>
<updated>2022-11-21T22:04:15+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2022-11-18T00:24:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3e3a4192d8cda0c308ea87b2e8f6f1e8dcc74739'/>
<id>urn:sha1:3e3a4192d8cda0c308ea87b2e8f6f1e8dcc74739</id>
<content type='text'>
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's
used in two ways:
- For representing attribute macro arguments (e.g. in `AttrItem`), where all
  three variants are used.
- For representing function-like macros (e.g. in `MacCall` and `MacroDef`),
  where only the `Delimited` variant is used.

In other words, `MacArgs` is used in two quite different places due to them
having partial overlap. I find this makes the code hard to read. It also leads
to various unreachable code paths, and allows invalid values (such as
accidentally using `MacArgs::Empty` in a `MacCall`).

This commit splits `MacArgs` in two:
- `DelimArgs` is a new struct just for the "delimited arguments" case. It is
  now used in `MacCall` and `MacroDef`.
- `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro
  case. Its `Delimited` variant now contains a `DelimArgs`.

Various other related things are renamed as well.

These changes make the code clearer, avoids several unreachable paths, and
disallows the invalid values.
</content>
</entry>
<entry>
<title>Remove `TreeAndSpacing`.</title>
<updated>2022-07-29T05:52:15+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2022-07-28T00:31:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=332dffb1f9964cdfcaa91853e4a65ccf6567138f'/>
<id>urn:sha1:332dffb1f9964cdfcaa91853e4a65ccf6567138f</id>
<content type='text'>
A `TokenStream` contains a `Lrc&lt;Vec&lt;(TokenTree, Spacing)&gt;&gt;`. But this is
not quite right. `Spacing` makes sense for `TokenTree::Token`, but does
not make sense for `TokenTree::Delimited`, because a
`TokenTree::Delimited` cannot be joined with another `TokenTree`.

This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`,
changing `TokenStream` to contain a `Lrc&lt;Vec&lt;TokenTree&gt;&gt;`, and removing the
`TreeAndSpacing` typedef.

The commit removes these two impls:
- `impl From&lt;TokenTree&gt; for TokenStream`
- `impl From&lt;TokenTree&gt; for TreeAndSpacing`

These were useful, but also resulted in code with many `.into()` calls
that was hard to read, particularly for anyone not highly familiar with
the relevant types. This commit makes some other changes to compensate:
- `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`.
- `TokenStream::token_{alone,joint}()` are added.
- `TokenStream::delimited` is added.

This results in things like this:
```rust
TokenTree::token(token::Semi, stmt.span).into()
```
changing to this:
```rust
TokenStream::token_alone(token::Semi, stmt.span)
```
This makes the type of the result, and its spacing, clearer.

These changes also simplifies `Cursor` and `CursorRef`, because they no longer
need to distinguish between `next` and `next_with_spacing`.
</content>
</entry>
<entry>
<title>use `CursorRef` more, to not to clone `Tree`s</title>
<updated>2022-05-18T15:43:48+00:00</updated>
<author>
<name>klensy</name>
<email>klensy@users.noreply.github.com</email>
</author>
<published>2022-05-16T15:58:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cc5f3e21ac365d793d776b26f16be7801ee04cf3'/>
<id>urn:sha1:cc5f3e21ac365d793d776b26f16be7801ee04cf3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`</title>
<updated>2022-04-28T07:04:29+00:00</updated>
<author>
<name>Vadim Petrochenkov</name>
<email>vadim.petrochenkov@gmail.com</email>
</author>
<published>2022-04-26T12:40:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2733ec1be34b1ae9f22c70c901bb89229adf9def'/>
<id>urn:sha1:2733ec1be34b1ae9f22c70c901bb89229adf9def</id>
<content type='text'>
</content>
</entry>
<entry>
<title>re-format with new rustfmt</title>
<updated>2021-11-30T18:08:41+00:00</updated>
<author>
<name>Mark Rousskov</name>
<email>mark.simulacrum@gmail.com</email>
</author>
<published>2021-11-30T18:08:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=971c549ca334b7b7406e61e958efcca9c4152822'/>
<id>urn:sha1:971c549ca334b7b7406e61e958efcca9c4152822</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rework SESSION_GLOBALS API to prevent overwriting it</title>
<updated>2021-07-08T14:16:28+00:00</updated>
<author>
<name>Guillaume Gomez</name>
<email>guillaume1.gomez@gmail.com</email>
</author>
<published>2021-05-05T19:31:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a2654fb64c9c9d368063b488693d8da17bc9b4e9'/>
<id>urn:sha1:a2654fb64c9c9d368063b488693d8da17bc9b4e9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use the now available implementation of `IntoIterator` for arrays</title>
<updated>2021-06-14T21:40:09+00:00</updated>
<author>
<name>LeSeulArtichaut</name>
<email>leseulartichaut@gmail.com</email>
</author>
<published>2021-06-14T21:40:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e3ca81fd5a33406078db0fc7f5f1c47ccfcd58b8'/>
<id>urn:sha1:e3ca81fd5a33406078db0fc7f5f1c47ccfcd58b8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ast: Keep expansion status for out-of-line module items</title>
<updated>2021-02-18T10:07:49+00:00</updated>
<author>
<name>Vadim Petrochenkov</name>
<email>vadim.petrochenkov@gmail.com</email>
</author>
<published>2021-02-16T21:56:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=4a8816512477513f57986685738cd065e72c4908'/>
<id>urn:sha1:4a8816512477513f57986685738cd065e72c4908</id>
<content type='text'>
Also remove `ast::Mod` which is mostly redundant now
</content>
</entry>
<entry>
<title>Force token collection to run when parsing nonterminals</title>
<updated>2021-01-20T23:09:32+00:00</updated>
<author>
<name>Aaron Hill</name>
<email>aa1ronham@gmail.com</email>
</author>
<published>2021-01-18T21:47:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=11b1e370161dd09c095350c66f7b187fc9654ec6'/>
<id>urn:sha1:11b1e370161dd09c095350c66f7b187fc9654ec6</id>
<content type='text'>
Fixes #81007

Previously, we would fail to collect tokens in the proper place when
only builtin attributes were present. As a result, we would end up with
attribute tokens in the collected `TokenStream`, leading to duplication
when we attempted to prepend the attributes from the AST node.

We now explicitly track when token collection must be performed due to
nomterminal parsing.
</content>
</entry>
</feed>
