Open
Description
Code
(playground, updated 2024-01-25 to account for a change to the syntax of macro metavariable expressions)
#![feature(macro_metavar_expr)]
#![warn(meta_variable_misuse)]
macro_rules! foo {
($($id:ident),* $(,)?) => {
${count($id)}
};
}
fn main() {
assert_eq!(foo!(a, b, c), 3);
}
Current output
warning: variable 'id' is still repeating at this depth
--> src/main.rs:6:10
|
5 | ($($id:ident),* $(,)?) => {
| - expected repetition
6 | ${count($id)}
| ^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![warn(meta_variable_misuse)]
| ^^^^^^^^^^^^^^^^^^^^
Desired output
No diagnostics should be emitted.
Rationale and extra context
This code builds and runs just fine; ${count($foo)}
doesn't have to be in a repetition of $foo
.
Anything else?
@rustbot modify labels +A-macros +D-papercut +F-macro-metavar-expr