Skip to content

Commit d850da5

Browse files
authoredMay 25, 2024··
Merge pull request #455 from CensoredUsername/master
Add a warning to `Delimiter::None` that rustc currently does not respect it.
2 parents 1b77aca + eabac15 commit d850da5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎src/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,18 @@ pub enum Delimiter {
685685
/// operator priorities in cases like `$var * 3` where `$var` is `1 + 2`.
686686
/// Invisible delimiters may not survive roundtrip of a token stream through
687687
/// a string.
688+
///
689+
/// <div class="warning">
690+
///
691+
/// Note: rustc currently can ignore the grouping of tokens delimited by `None` in the output
692+
/// of a proc_macro. Only `None`-delimited groups created by a macro_rules macro in the input
693+
/// of a proc_macro macro are preserved, and only in very specific circumstances.
694+
/// Any `None`-delimited groups (re)created by a proc_macro will therefore not preserve
695+
/// operator priorities as indicated above. The other `Delimiter` variants should be used
696+
/// instead in this context. This is a rustc bug. For details, see
697+
/// [rust-lang/rust#67062](https://github.com/rust-lang/rust/issues/67062).
698+
///
699+
/// </div>
688700
None,
689701
}
690702

0 commit comments

Comments
 (0)
Please sign in to comment.