<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct A { a: Option&lt;@mut A&gt; }
fn main() {
  let a = @mut A { a: None }; let mut v = Some(a); a.a &lt;-&gt; v;
  io::println(fmt!(&quot;%?&quot;,a));
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span><span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span>@<span class="pl-k">mut</span> <span class="pl-smi">A</span><span class="pl-kos">&gt;</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-k">let</span> a = @<span class="pl-k">mut</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span><span class="pl-kos">:</span> <span class="pl-v">None</span> <span class="pl-kos">}</span><span class="pl-kos">;</span> <span class="pl-k">let</span> <span class="pl-k">mut</span> v = <span class="pl-v">Some</span><span class="pl-kos">(</span>a<span class="pl-kos">)</span><span class="pl-kos">;</span> a<span class="pl-kos">.</span><span class="pl-c1">a</span> &lt;-&gt; v<span class="pl-kos">;</span>
  io<span class="pl-kos">::</span><span class="pl-en">println</span><span class="pl-kos">(</span><span class="pl-en">fmt</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"%?"</span>,a<span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This causes the formatter to go into an infinite loop.</p>
<p dir="auto">Nominating for maturity 3, since it's mostly likely a problem with the reflection api.</p>
<p dir="auto">Whenever <code class="notranslate">%?</code> is used on a data structure with cycles (such as servo's <code class="notranslate">util::tree</code>), it will traverse cycles and run out of stack. This could be fixed with some expensive but easy thing like keeping a list of already-traversed boxed things, and declining to traverse twice.</p>