This code should fail to compile, giving the same error message as fn use() would give, but it compiles successfully.
macro_rules! foo {
($foo:ident) => {}
}
fn main() {
foo!(use);
}
This code should compile successfully. However, it fails complaining that it can't decide whether use is an ident or not (hint: it isn't). It also shouldn't be trying to match use as an ident because of the semicolon, but that's a broader/deeper issue with macro_rules!
macro_rules! foo {
($(use ;)* $foo:ident) => {}
}
fn main() {
foo!(use ; use ; bar);
}
This code should fail to compile, giving the same error message as
fn use()would give, but it compiles successfully.This code should compile successfully. However, it fails complaining that it can't decide whether
useis an ident or not (hint: it isn't). It also shouldn't be trying to matchuseas an ident because of the semicolon, but that's a broader/deeper issue withmacro_rules!