about summary refs log tree commit diff
path: root/src/test/ui/ast-json
AgeCommit message (Collapse)AuthorLines
2022-06-03Remove support for -Zast-json and -Zast-json-noexpandbjorn3-78/+0
2022-05-05Overhaul `MacArgs::Eq`.Nicholas Nethercote-2/+2
The value in `MacArgs::Eq` is currently represented as a `Token`. Because of `TokenKind::Interpolated`, `Token` can be either a token or an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a literal or macro call AST fragment, and then is later lowered to a literal token. But this is very non-obvious. `Token` is a much more general type than what is needed. This commit restricts things, by introducing a new type `MacArgsEqKind` that is either an AST expression (pre-lowering) or an AST literal (post-lowering). The downside is that the code is a bit more verbose in a few places. The benefit is that makes it much clearer what the possibilities are (though also shorter in some other places). Also, it removes one use of `TokenKind::Interpolated`, taking us a step closer to removing that variant, which will let us make `Token` impl `Copy` and remove many "handle Interpolated" code paths in the parser. Things to note: - Error messages have improved. Messages like this: ``` unexpected token: `"bug" + "found"` ``` now say "unexpected expression", which makes more sense. Although arbitrary expressions can exist within tokens thanks to `TokenKind::Interpolated`, that's not obvious to anyone who doesn't know compiler internals. - In `parse_mac_args_common`, we no longer need to collect tokens for the value expression.
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-2/+2
then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-03-03Associate multiple with a crate too.Felix S. Klock II-2/+2
2022-01-12Remove ui tests for LLVM-style inline assemblyTomasz Miąsko-9/+0
2022-01-05ast: Always keep a `NodeId` in `ast::Crate`Vadim Petrochenkov-2/+2
This makes it more uniform with other expanded nodes
2021-11-28expand: Turn `ast::Crate` into a first class expansion targetVadim Petrochenkov-2/+2
And stop creating a fake `mod` item for the crate root when expanding a crate.
2021-09-02Bless ast-json tests.Camille GILLOT-2/+2
2021-08-15Fix ui tests for llvm_asm! deprecationAmanieu d'Antras-0/+1
2021-02-25Update test output for edition preludes.Mara Bos-1/+1
2021-02-18ast: Stop using `Mod` in `Crate`Vadim Petrochenkov-2/+2
Crate root is sufficiently different from `mod` items, at least at syntactic level. Also remove customization point for "`mod` item or crate root" from AST visitors.
2021-01-24parser: Collect tokens for values in key-value attributesVadim Petrochenkov-2/+2
2021-01-09ast: Remove some indirection layers from values in key-value attributesVadim Petrochenkov-2/+2
2020-12-09Accept arbitrary expressions in key-value attributes at parse timeVadim Petrochenkov-2/+2
2020-11-09Do not collect tokens for doc commentsVadim Petrochenkov-2/+2
2020-11-01Do not remove tokens before AST json serializationVadim Petrochenkov-55/+25
2020-10-29Strip tokens from trait and impl items before printing AST JSONAaron Hill-0/+34
Fixes #78510
2020-10-26Remove tokens from foreign items in `TokenStripper`Aaron Hill-0/+19
Fixes #78398 I forgot to handle this case in #77255
2020-10-21Strip tokens before printing AST JSONAaron Hill-2/+2
2020-10-21Unconditionally capture tokens for attributes.Aaron Hill-2/+2
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.
2020-09-10Fully integrate token collection for additional AST structsAaron Hill-2/+2
This commit contains miscellaneous changes that don't fit into any of the other commits in this PR
2020-09-10Syntactically permit unsafety on modsDavid Tolnay-2/+2
2020-09-03Rename IsJoint -> SpacingAleksey Kladov-2/+2
To match better naming from proc-macro
2020-08-14Fix tests and address review commentsMatthew Jasper-2/+2
2020-05-25Only capture tokens for items with outer attributesAaron Hill-2/+2
Suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/43081#issuecomment-633389225
2020-05-22Rewrite `Parser::collect_tokens`Aaron Hill-2/+2
The previous implementation did not work when called on an opening delimiter, or when called re-entrantly from the same `TokenCursor` stack depth.
2020-04-19check '-Zast-json' & '-Zast-json-noexpand' to output legal JSONJOE1994-2/+14
2020-03-26Update tests to use llvm_asm!Amanieu d'Antras-2/+2
2020-02-15Record proc macro harness order for use during metadata deserializationAaron Hill-1/+1
Fixes #68690 When we generate the proc macro harness, we now explicitly recorder the order in which we generate entries. We then use this ordering data to deserialize the correct proc-macro-data from the crate metadata.
2019-11-11syntactically allow visibility on trait item & enum variantMazdak Farrokhzad-1/+1
2019-10-21Derive `Rustc{En,De}codable` for `TokenStream`.Nicholas Nethercote-1/+1
`TokenStream` used to be a complex type, but it is now just a newtype around a `Lrc<Vec<TreeAndJoint>>`. Currently it uses custom encoding that discards the `IsJoint` and custom decoding that adds `NonJoint` back in for every token tree. This requires building intermediate `Vec<TokenTree>`s. This commit makes `TokenStream` derive `Rustc{En,De}codable`. This simplifies the code, and avoids the creation of the intermediate vectors, saving up to 3% on various benchmarks. It also changes the AST JSON output in one test.
2019-09-26Fix AST JSON output testvarkor-1/+1
2019-08-27Add default serialization for `Ident`sMatthew Jasper-0/+51
Add tests for -Zast-json and -Zast-json-noexpand, which need this impl.