#E0116: malformed macro definition
A macro's rules are not well formed. Each rule is ( matcher ) => { template }, a metavariable is @name: fragment, and a repetition is @rep[sep = ","] { .. }.
nabi
#[impl_macro(twice)] @macro {
@e: expr => { (@e, @e) }
}
let p = twice!(3);
error[E0116]: a macro rule starts with `( matcher )` --> main.nabi:2:5 | 2 | @e: expr => { (@e, @e) } | ^
Wrap the matcher in parentheses:
nabi
#[impl_macro(twice)] @macro {
( @e: expr ) => { { let v = @e; (v, v) } }
}
let p = twice!(3);
println(f"{p.0 + p.1}");
6
Related: E0117 no macro rule matches, E0118 invalid meta template
Found a mistake? Edit this page on GitHub. Last updated