<p dir="auto">In this code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fn foo() {
  match Some(x) {
      Some(y) { fail!(); }
      None    { fail!(); }
}

fn bar() {
    let mut i = 0;
    while (i &lt; 1000) {}
}

fn main() {}"><pre class="notranslate"><code class="notranslate">fn foo() {
  match Some(x) {
      Some(y) { fail!(); }
      None    { fail!(); }
}

fn bar() {
    let mut i = 0;
    while (i &lt; 1000) {}
}

fn main() {}
</code></pre></div>
<p dir="auto"><code class="notranslate">foo</code> is missing the close brace for the <code class="notranslate">alt</code>, but the resulting parse error message is very unhelpful:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="src/test/compile-fail/bad.rs:12:13: 12:13 error: unexpected token: '&lt;eof&gt;'
src/test/compile-fail/bad.rs:12 fn main() {}
                                                                   ^"><pre class="notranslate"><code class="notranslate">src/test/compile-fail/bad.rs:12:13: 12:13 error: unexpected token: '&lt;eof&gt;'
src/test/compile-fail/bad.rs:12 fn main() {}
                                                                   ^
</code></pre></div>
<p dir="auto">It would be much more helpful to report the error at the location where the un-closed brace was (in this case, after the alt in <code class="notranslate">foo</code>). I don't know how easy it would be to do with the current parser, though.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fn x() { }
fn y() {
fn z() { }"><pre class="notranslate"><code class="notranslate">fn x() { }
fn y() {
fn z() { }
</code></pre></div>
<p dir="auto">Result:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="a.rs:3:9:3:10: error: unexpected token: &lt;eof&gt;"><pre class="notranslate"><code class="notranslate">a.rs:3:9:3:10: error: unexpected token: &lt;eof&gt;
</code></pre></div>
<p dir="auto">Expected: something like of "missing } after function body which begins on line 2".</p>