rust/src/librustc_parse/parser
Manish Goregaokar 8ed5c0d37a
Rollup merge of #73345 - petrochenkov:nointerp, r=Aaron1011
expand: Stop using nonterminals for passing tokens to attribute and derive macros

Make one more step towards fully token-based expansion and fix issues described in https://github.com/rust-lang/rust/issues/72545#issuecomment-640276791.

Now `struct S;` is passed to `foo!(struct S;)` and `#[foo] struct S;` in the same way - as a token stream `struct S ;`, rather than a single non-terminal token `NtItem` which is then broken into parts later.

The cost is making pretty-printing of token streams less pretty.
Some of the pretty-printing regressions will be recovered by keeping jointness with each token, which we will need to do anyway.

Unfortunately, this is not exactly the same thing as https://github.com/rust-lang/rust/pull/73102.
One more observable effect is how `$crate` is printed in the attribute input.
Inside `NtItem` was printed as `crate` or `that_crate`, now as a part of a token stream it's printed as `$crate` (there are good reasons for these differences, see https://github.com/rust-lang/rust/pull/62393 and related PRs).
This may break old proc macros (custom derives) written before the main portion of the proc macro API (macros 1.2) was stabilized, those macros did `input.to_string()` and reparsed the result, now that result can contain `$crate` which cannot be reparsed.

So, I think we should do this regardless, but we need to run crater first.
r? @Aaron1011
2020-07-01 20:35:44 -07:00
..
attr.rs Remove token::FlattenGroup 2020-07-01 13:40:46 +03:00
diagnostics.rs Fix wording for anonymous parameter name help 2020-06-27 22:55:42 -05:00
expr.rs Remove token::FlattenGroup 2020-07-01 13:40:46 +03:00
generics.rs Record span of const kw in GenericParamKind 2020-06-23 09:25:46 -07:00
item.rs Remove token::FlattenGroup 2020-07-01 13:40:46 +03:00
mod.rs Remove token::FlattenGroup 2020-07-01 13:40:46 +03:00
pat.rs Remove token::FlattenGroup 2020-07-01 13:40:46 +03:00
path.rs Remove ast::{Ident, Name} reexports. 2020-05-08 13:13:15 +02:00
stmt.rs Adjust according to petrochenkov's review comments 2020-05-21 20:08:26 +02:00
ty.rs parse: recover on const fn() / async fn(). 2020-03-26 09:44:11 +01:00