docs

你正在阅读 v0.1.2 的文档。Nabi 0.1.2 已不再提供支持。 最新版本:v0.1.3 →

本页尚未翻译,以下为英文原文。

#E0120: recursive expansion

A macro or meta block expands into itself, directly or through others, without end. Break the cycle.

nabi
#[impl_macro(again)] @macro {
    ( @e: expr ) => { again!(@e) }
}
let x = again!(1);
error[E0120]: `again!` expands too deeply or cyclically
  --> main.nabi:4:9
   |
 4 | let x = again!(1);
   |         ^^^^^

Make the template expand to code that does not call the macro again:

nabi
#[impl_macro(again)] @macro {
    ( @e: expr ) => { (@e, @e) }
}
let x = again!(1);
println(f"{x.0}");
1

Related: E0117 no macro rule matches, E0118 invalid meta template

Found a mistake? Edit this page on GitHub. Last updated