Skip to content

Commit

Permalink
Add a warning to Delimiter::None that rustc currently does not respec…
Browse files Browse the repository at this point in the history
…t it.

It does not provide the behaviour it is indicated to provide when used in
a proc_macro context.
  • Loading branch information
CensoredUsername committed Apr 26, 2024
1 parent 3a36386 commit 3218540
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,16 @@ pub enum Delimiter {
/// "macro variable" `$var`. It is important to preserve operator priorities in cases like
/// `$var * 3` where `$var` is `1 + 2`.
/// Invisible delimiters might not survive roundtrip of a token stream through a string.
///
/// <div class="warning">
///
/// Note: rustc currently (1.77 and below) ignores the grouping of tokens
/// delimited by `None` in the output of a proc_macro. Thus it will not
/// preserve operator priorities as indicated above. The other `Delimiter`
/// variants should be used instead in this context. For details, see
/// [rust-lang/rust#67062](https://github.com/rust-lang/rust/issues/67062).
///
/// </div>
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
None,
}
Expand Down

0 comments on commit 3218540

Please sign in to comment.