<p dir="auto">Place a macro like <code class="notranslate">panic!</code> or <code class="notranslate">println!</code> outside of a function body:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="panic!(&quot;outside of a function&quot;);
fn main() { }"><pre class="notranslate"><code class="notranslate">panic!("outside of a function");
fn main() { }
</code></pre></div>
<p dir="auto">The error message does not provide the expansion site:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;std macros&gt;:2:1: 2:2 error: macro expansion ignores token `{` and any following
&lt;std macros&gt;:2 {
               ^
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">&lt;std macros&gt;:2:1: 2:2 error: macro expansion ignores token `{` and any following
&lt;std macros&gt;:2 {
               ^
error: aborting due to previous error
</code></pre></div>
<p dir="auto">A similar effect is had in an impl body.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct Foo;

impl Foo{
  panic!(&quot;in impl body&quot;);
}

fn main() {}

----------------------
&lt;std macros&gt;:2:1: 2:2 error: expected `fn`, found `{`
&lt;std macros&gt;:2 {
               ^"><pre class="notranslate"><code class="notranslate">struct Foo;

impl Foo{
  panic!("in impl body");
}

fn main() {}

----------------------
&lt;std macros&gt;:2:1: 2:2 error: expected `fn`, found `{`
&lt;std macros&gt;:2 {
               ^
</code></pre></div>
<p dir="auto">afaik, it's because the context where you're using the macro (expr, item, etc.) stopped parsing before that token.  We should mention that context.</p>