<p dir="auto">I'm not exactly sure what it's supposed to do, but it seems wrong:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#![feature(macro_rules)]
macro_rules! some_stmts(
    ({ $($s:stmt)* }) =&gt; ($($s)*)
)

fn main() {
    some_stmts!({
        //let a = 5;
        type a = int;
    })
}"><pre class="notranslate"><code class="notranslate">#![feature(macro_rules)]
macro_rules! some_stmts(
    ({ $($s:stmt)* }) =&gt; ($($s)*)
)

fn main() {
    some_stmts!({
        //let a = 5;
        type a = int;
    })
}
</code></pre></div>
<p dir="auto">As is, we get:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="stmts.rs:10:5: 10:6 error: local ambiguity: multiple parsing options: built-in NTs stmt ('s') or 1 other options.
stmts.rs:10     })"><pre class="notranslate"><code class="notranslate">stmts.rs:10:5: 10:6 error: local ambiguity: multiple parsing options: built-in NTs stmt ('s') or 1 other options.
stmts.rs:10     })
</code></pre></div>
<p dir="auto">even though there is no way <code class="notranslate">}</code> could start a statement.  With the <code class="notranslate">let</code> instead, it's</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="stmts.rs:8:18: 8:19 error: unexpected token: `;`
stmts.rs:8         let a = 5;"><pre class="notranslate"><code class="notranslate">stmts.rs:8:18: 8:19 error: unexpected token: `;`
stmts.rs:8         let a = 5;
</code></pre></div>
<p dir="auto">which doesn't seem to make sense either.</p>
<p dir="auto">rustc 0.11-pre-nightly (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/d35804ea5e69c9a3a8957626533a856f976fe4e3/hovercard" href="https://github.com/rust-lang/rust/commit/d35804ea5e69c9a3a8957626533a856f976fe4e3"><tt>d35804e</tt></a> 2014-04-18 00:01:22 -0700)</p>
<p dir="auto">Currently, the following macro argument grammar will not successfully parse anything, complaining of a "local ambiguity":</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" $( $t:ty )* #"><pre class="notranslate"><code class="notranslate"> $( $t:ty )* #
</code></pre></div>
<p dir="auto">The problem is that if it were to use the Rust parser to try to parse a type and fail, the whole task would be killed. This is easy to fix after that problem is resolved. There are two options:</p>
<ol dir="auto">
<li>Break parsing into a separate task, and see whether it survives. However, parse.rs requires a <code class="notranslate">parse_sess</code>, which is mutable state, and can't be shared. So the second option is probably more doable:</li>
<li>Allow the parser to safely return instead of killing the task. This works much like the Error monad. Ordinarily, this would require a lot of tedious wrapping and unwrapping, but we have a macro system! It should be relatively easy to make a notation like Haskell's <code class="notranslate">do</code>, and the parser would be able to stay in the standard imperative style.</li>
</ol>