You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was changed in rust-lang/rust#39419 in 1.17. That PR didn't mention this behavior change, so it is not clear if it was intentional. I believe this behavior is due to this line.
I see quite a lot of crates on crates.io relying on this behavior, so I don't think it is something that can be (easily) changed. I would lean towards just updating the documentation. Or perhaps it could be restricted to be a bare dollar within delimiters like ($) or [$] or {$} which is what almost all of the usages are (I didn't do an exhaustive check for the last$ style).
instance, the matcher `(())` will match `{()}` but not `{{}}`. The character
`$` cannot be matched or transcribed literally.
I think this is wrong on multiple points. $ can be transcribed literally (often used for emitting macros). $ can be matched as the last token of a token tree. $$ can be transcribed to a $ (via Add stable references of macro_metavar_expr #1192).
Generally I think the mbe documentation could use a lot of expansion to describe its behavior more precisely and completely, this is just a small part that could be improved.
The text was updated successfully, but these errors were encountered:
Macro matchers allow
$
as the last token of a token tree:This was changed in rust-lang/rust#39419 in 1.17. That PR didn't mention this behavior change, so it is not clear if it was intentional. I believe this behavior is due to this line.
I see quite a lot of crates on crates.io relying on this behavior, so I don't think it is something that can be (easily) changed. I would lean towards just updating the documentation. Or perhaps it could be restricted to be a bare dollar within delimiters like
($)
or[$]
or{$}
which is what almost all of the usages are (I didn't do an exhaustive check for thelast$
style).Initially the parts that could be updated are:
$
":reference/src/macros-by-example.md
Line 24 in 0cd078d
This could be updated, though it is starting to get too complex to explain in a subscript.
$
cannot be matched or transcribed literally.":reference/src/macros-by-example.md
Lines 76 to 77 in 0cd078d
I think this is wrong on multiple points.
$
can be transcribed literally (often used for emitting macros).$
can be matched as the last token of a token tree.$$
can be transcribed to a$
(via Add stable references ofmacro_metavar_expr
#1192).Generally I think the mbe documentation could use a lot of expansion to describe its behavior more precisely and completely, this is just a small part that could be improved.
The text was updated successfully, but these errors were encountered: