-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-macro_metavar_expr`#![feature(macro_metavar_expr)]``#![feature(macro_metavar_expr)]`requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code:
#![feature(macro_metavar_expr)]
macro_rules! foo {
( $( $($t:ident),* );* ) => { ${count(t,)} }
}
fn test() {
foo!(a, a; b, b);
}
I expected to see this happen:
Either:
- The macro definition is rejected, leading to a compile error.
${count(t,)}
is interpreted as${count(t)}
, the macro call is expanded to4
.
Instead, this happened:
Compiled successfully, ${count(t,)}
is interpreted as ${count(t, 0)}
, the macro call is expanded to 2
.
This form of ${count()}
metavar expression is not specified in RFC 3086, so this is more of an ask for clarification than a bug report.
Meta
rustc --version --verbose
:
1.71.0-nightly (2023-05-23 5ea3f0ae08c07472239a)
cc #83527
@rustbot label requires-nightly F-macro-metavar-expr
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-macro_metavar_expr`#![feature(macro_metavar_expr)]``#![feature(macro_metavar_expr)]`requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.