Fixup path fragments upon MBE transcription

This commit is contained in:
Ryo Yoshida 2023-07-30 23:36:42 +09:00
parent 037844c8a0
commit fd7435d463
No known key found for this signature in database
GPG key ID: E25698A930586171
5 changed files with 89 additions and 5 deletions

View file

@ -123,4 +123,14 @@ enum Fragment {
/// proc-macro delimiter=none. As we later discovered, "none" delimiters are
/// tricky to handle in the parser, and rustc doesn't handle those either.
Expr(tt::TokenTree),
/// There are roughly two types of paths: paths in expression context, where a
/// separator `::` between an identifier and its following generic argument list
/// is mandatory, and paths in type context, where `::` can be omitted.
///
/// Unlike rustc, we need to transform the parsed fragments back into tokens
/// during transcription. When the matched path fragment is a type-context path
/// and is trasncribed as an expression-context path, verbatim transcription
/// would cause a syntax error. We need to fix it up just before transcribing;
/// see `transcriber::fix_up_and_push_path_tt()`.
Path(tt::TokenTree),
}