mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Fixup path fragments upon MBE transcription
This commit is contained in:
parent
037844c8a0
commit
fd7435d463
5 changed files with 89 additions and 5 deletions
|
@ -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),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue