Closed
Description
#![feature(macro_metavar_expr)]
macro_rules! metavar {
( $i:expr ) => {
${length(0)}
};
}
const _: i32 = metavar!(0);
errors with:
error: length depth must be less than 0
--> src/main.rs:5:10
|
5 | ${length(0)}
| ^^^^^^^^^^^
However, passing -1
as the depth is rejected with:
error: meta-variable expression depth must be a literal
--> src/main.rs:5:11
|
5 | ${length(-1)}
| ^^^^^^
error: expected expression, found `$`
--> src/main.rs:5:9
|
5 | ${length(-1)}
| ^ expected expression