Skip to content

Commit 3218540

Browse files
Add a warning to Delimiter::None that rustc currently does not respect it.
It does not provide the behaviour it is indicated to provide when used in a proc_macro context.
1 parent 3a36386 commit 3218540

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/proc_macro/src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,16 @@ pub enum Delimiter {
815815
/// "macro variable" `$var`. It is important to preserve operator priorities in cases like
816816
/// `$var * 3` where `$var` is `1 + 2`.
817817
/// Invisible delimiters might not survive roundtrip of a token stream through a string.
818+
///
819+
/// <div class="warning">
820+
///
821+
/// Note: rustc currently (1.77 and below) ignores the grouping of tokens
822+
/// delimited by `None` in the output of a proc_macro. Thus it will not
823+
/// preserve operator priorities as indicated above. The other `Delimiter`
824+
/// variants should be used instead in this context. For details, see
825+
/// [rust-lang/rust#67062](https://github.com/rust-lang/rust/issues/67062).
826+
///
827+
/// </div>
818828
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
819829
None,
820830
}

0 commit comments

Comments
 (0)