"<
is interpreted as a start of generic arguments for '_', not a comparison" #44406
Closed
Description
Playground link: https://play.rust-lang.org/?gist=e93b00dd6c33bf6bbcc035a7be501592&version=stable
macro_rules! foo {
(
$(
bar: {
$($rest:tt)+
}
)+
) => {
$(
bar($($rest)+);
)+
};
}
macro_rules! bar {
(baz: $baz:expr,) => {};
}
fn main() {
foo!{
bar: {
baz: true,
}
}
}
Compiling playground v0.0.1 (file:///playground)
error: expected identifier, found keyword `true`
--> src/main.rs:24:18
|
24 | baz: true,
| ^^^^
error: `<` is interpreted as a start of generic arguments for `true`, not a comparison
--> src/main.rs:24:22
|
24 | baz: true,
| -
| |
| not interpreted as comparison
| interpreted as generic arguments
|
help: if you want to compare the casted value then write:
|
24 | (baz: true),
| ^^^^^^^^^^^
error: aborting due to 2 previous errors
error: Could not compile `playground`.
To learn more, run the command again with --verbose.