rust/src/test/ui/malformed
Nicholas Nethercote 99f5945f85 Overhaul MacArgs::Eq.
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-05-05 07:06:12 +10:00
..
issue-69341-malformed-derive-inert.rs expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
issue-69341-malformed-derive-inert.stderr expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
malformed-derive-entry.rs derive: avoid parse_in_attr 2019-12-06 20:37:59 +01:00
malformed-derive-entry.stderr Suggest derivable trait on E0277 2022-04-05 11:14:32 +09:00
malformed-interpolated.rs Overhaul MacArgs::Eq. 2022-05-05 07:06:12 +10:00
malformed-interpolated.stderr Overhaul MacArgs::Eq. 2022-05-05 07:06:12 +10:00
malformed-meta-delim.rs parse_meta: ditch parse_in_attr 2019-12-06 21:17:18 +01:00
malformed-meta-delim.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
malformed-plugin-1.rs plugin_registrary: use normal deprecation instead of hard coded warning. 2019-10-03 07:03:01 +02:00
malformed-plugin-1.stderr Move malformed attribute code to a function and fix inner attribute suggestion. 2021-09-25 08:11:10 -07:00
malformed-plugin-2.rs plugin_registrary: use normal deprecation instead of hard coded warning. 2019-10-03 07:03:01 +02:00
malformed-plugin-2.stderr Move malformed attribute code to a function and fix inner attribute suggestion. 2021-09-25 08:11:10 -07:00
malformed-plugin-3.rs plugin_registrary: use normal deprecation instead of hard coded warning. 2019-10-03 07:03:01 +02:00
malformed-plugin-3.stderr Add long explanation for E0498 2021-07-27 18:06:34 +01:00
malformed-regressions.rs ill_formed_attribute_input -> deny 2019-11-06 11:10:37 +01:00
malformed-regressions.stderr #[link]: mention wasm_import_module instead of cfg 2020-03-29 17:40:04 +02:00
malformed-special-attrs.rs cfg_attr: avoid .outer_tokens 2019-12-06 20:37:59 +01:00
malformed-special-attrs.stderr expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00