<p dir="auto">We got the following warning message:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="warning: variant is never used: `Foo`, #[warn(dead_code)] on by default"><pre class="notranslate">warning: variant is never used: <span class="pl-s"><span class="pl-pds">`</span>Foo<span class="pl-pds">`</span></span>, <span class="pl-c"><span class="pl-c">#</span>[warn(dead_code)] on by default</span></pre></div>
<p dir="auto">For this code:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum Something {
    Foo,
    NotFoo
}

fn main() {
    match Something::NotFoo {
        Something::Foo =&gt; {}
        _ =&gt; {}
    }
}"><pre class="notranslate"><span class="pl-k">enum</span> <span class="pl-smi">Something</span> <span class="pl-kos">{</span>
    <span class="pl-v">Foo</span><span class="pl-kos">,</span>
    <span class="pl-v">NotFoo</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">match</span> <span class="pl-smi">Something</span><span class="pl-kos">::</span><span class="pl-v">NotFoo</span> <span class="pl-kos">{</span>
        <span class="pl-smi">Something</span><span class="pl-kos">::</span><span class="pl-v">Foo</span> =&gt; <span class="pl-kos">{</span><span class="pl-kos">}</span>
        _ =&gt; <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 warning could mislead users because for them, the Foo variant is used. Adding a specific warning message could be nice.</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/eddyb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/eddyb">@eddyb</a> proposed this message instead in this case:</p>
<p dir="auto">"this variant is never instantiated"</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/eddyb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/eddyb">@eddyb</a></p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mod a {
    #[deriving(Show)]
    pub enum E {
        Variant1,
        Variant2,
    }
}

fn main() {
    let x = a::E::Variant1;
    let y = match x {
        a::E::Variant1 =&gt; 1i,
        a::E::Variant2 =&gt; 2i,
    };
    println!(&quot;Hello world: {}&quot;, (x, y));
}"><pre class="notranslate"><span class="pl-k">mod</span> a <span class="pl-kos">{</span>
    <span class="pl-c1">#<span class="pl-kos">[</span>deriving<span class="pl-kos">(</span><span class="pl-v">Show</span><span class="pl-kos">)</span><span class="pl-kos">]</span></span>
    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">E</span> <span class="pl-kos">{</span>
        <span class="pl-v">Variant1</span><span class="pl-kos">,</span>
        <span class="pl-v">Variant2</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-k">let</span> x = a<span class="pl-kos">::</span><span class="pl-smi">E</span><span class="pl-kos">::</span><span class="pl-v">Variant1</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> y = <span class="pl-k">match</span> x <span class="pl-kos">{</span>
        a<span class="pl-kos">::</span><span class="pl-smi">E</span><span class="pl-kos">::</span><span class="pl-v">Variant1</span> =&gt; <span class="pl-c1">1</span>i<span class="pl-kos">,</span>
        a<span class="pl-kos">::</span><span class="pl-smi">E</span><span class="pl-kos">::</span><span class="pl-v">Variant2</span> =&gt; <span class="pl-c1">2</span>i<span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Hello world: {}"</span>, <span class="pl-kos">(</span>x, y<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">produces:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:5:9: 5:17 warning: variant is never used: `Variant2`, #[warn(dead_code)] on by default
&lt;anon&gt;:5         Variant2,
                 ^~~~~~~~"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:5:9: 5:17 warning: variant is never used: `Variant2`, #[warn(dead_code)] on by default
&lt;anon&gt;:5         Variant2,
                 ^~~~~~~~
</code></pre></div>