about summary refs log tree commit diff
path: root/src/test/ui/malformed/malformed-interpolated.rs
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-16/+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.
2020-12-09Accept arbitrary expressions in key-value attributes at parse timeVadim Petrochenkov-4/+3
2019-06-08Introduce `#[rustc_dummy]` attribute and use it in testsVadim Petrochenkov-3/+3
Unlike other built-in attributes, this attribute accepts any input
2019-05-11Simplify conversions between tokens and semantic literalsVadim Petrochenkov-3/+2
2019-02-25Restrict value in key-value attributes to literalsVadim Petrochenkov-0/+18