rust/src
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
..
bootstrap Auto merge of #95170 - jyn514:ci-llvm, r=Mark-Simulacrum 2022-04-27 13:27:22 +00:00
ci Update LLVM used for building rustc in CI for x64 to LLVM 14.0.2 2022-04-28 16:04:15 +02:00
doc Update books 2022-04-20 07:04:50 -07:00
etc Fix --bless not working anymore in htmldocck 2022-04-17 12:42:27 +02:00
librustdoc rustc_ast: Harmonize delimiter naming with proc_macro::Delimiter 2022-04-28 10:04:29 +03:00
llvm-project@fc10370ef7 Update LLVM submodule 2022-04-28 16:04:15 +02:00
rustdoc-json-types rustdoc-json-types: implementors -> implementations 2022-03-14 00:05:11 +00:00
test Overhaul MacArgs::Eq. 2022-05-05 07:06:12 +10:00
tools Overhaul MacArgs::Eq. 2022-05-05 07:06:12 +10:00
README.md
stage0.json bump stage0 to the latest beta 2022-04-05 22:24:32 +02:00
version bump version to 1.62.0 2022-04-04 09:21:03 +02:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.