Skip to content

Commit

Permalink
Merge pull request #455 from CensoredUsername/master
Browse files Browse the repository at this point in the history
Add a warning to `Delimiter::None` that rustc currently does not respect it.
  • Loading branch information
dtolnay authored May 25, 2024
2 parents 1b77aca + eabac15 commit d850da5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,18 @@ pub enum Delimiter {
/// operator priorities in cases like `$var * 3` where `$var` is `1 + 2`.
/// Invisible delimiters may not survive roundtrip of a token stream through
/// a string.
///
/// <div class="warning">
///
/// Note: rustc currently can ignore the grouping of tokens delimited by `None` in the output
/// of a proc_macro. Only `None`-delimited groups created by a macro_rules macro in the input
/// of a proc_macro macro are preserved, and only in very specific circumstances.
/// Any `None`-delimited groups (re)created by a proc_macro will therefore not preserve
/// operator priorities as indicated above. The other `Delimiter` variants should be used
/// instead in this context. This is a rustc bug. For details, see
/// [rust-lang/rust#67062](https://github.com/rust-lang/rust/issues/67062).
///
/// </div>
None,
}

Expand Down

0 comments on commit d850da5

Please sign in to comment.