-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)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
#![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
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)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.