<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="macro_rules! foo {
    () =&gt; { foo!() }
}

foo!()"><pre class="notranslate"><span class="pl-k">macro_rules!</span> foo <span class="pl-kos">{</span>
    <span class="pl-kos">(</span><span class="pl-kos">)</span> =&gt; <span class="pl-kos">{</span> foo!<span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-en">foo</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">just eats memory continuously (until it either segfaults from stack-overflow or otherwise crashes from OOM, presumably).</p>
<p dir="auto">Defining macros recursively like so</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="macro_rules! recursive(
  () =&gt; (
    recursive!()
  )
)

fn main() {
  recursive!()
}"><pre class="notranslate"><span class="pl-k">macro_rules!</span> recursive<span class="pl-kos">(</span>
  <span class="pl-kos">(</span><span class="pl-kos">)</span> =&gt; <span class="pl-kos">(</span>
    recursive!<span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">)</span>
<span class="pl-kos">)</span><span class="pl-kos"></span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-en">recursive</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">will lead rustc to cause a stack overflow.<br>
It would be useful to improve the error message for that problem.<br>
There is currently no error message specified for that issue.</p>