<p dir="auto">If only the enumeration type itself is imported but not its variants, a match expression reports unreachable pattern instead of unrecognised type:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub mod inner {
  pub enum E {
    E1,
    E2
  }
}

pub mod foo {
  use inner::E; // change this to use inner::{E, E1, E2} then all will be fine

  pub fn bar(e: E) -&gt; int {
    match e {
      E1 =&gt; 0,
      E2 =&gt; 1    // error: unreachable pattern
    }
  }
}

pub fn main() {}"><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">mod</span> inner <span class="pl-kos">{</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">E1</span><span class="pl-kos">,</span>
    <span class="pl-v">E2</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">mod</span> foo <span class="pl-kos">{</span>
  <span class="pl-k">use</span> inner<span class="pl-kos">::</span><span class="pl-v">E</span><span class="pl-kos">;</span> <span class="pl-c">// change this to use inner::{E, E1, E2} then all will be fine</span>

  <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">:</span> <span class="pl-smi">E</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">int</span> <span class="pl-kos">{</span>
    <span class="pl-k">match</span> e <span class="pl-kos">{</span>
      <span class="pl-v">E1</span> =&gt; <span class="pl-c1">0</span><span class="pl-kos">,</span>
      <span class="pl-v">E2</span> =&gt; <span class="pl-c1">1</span>    <span class="pl-c">// error: unreachable pattern</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</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-kos">}</span></pre></div>
<p dir="auto">Is this something intentional? Or should we give it a more sensible error message?</p>
<p dir="auto">This code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mod foo {
  pub enum Bars {
    BarFoo,
    BarBar,
    BarBaz
  }
}

fn main() {
    decide(foo::BarBar);
}

fn decide(bar: foo::Bars) -&gt; int {
    match bar {
        BarFoo =&gt; 0,
        BarBar =&gt; 42,
        BarBaz =&gt; 128
    }
}"><pre class="notranslate"><code class="notranslate">mod foo {
  pub enum Bars {
    BarFoo,
    BarBar,
    BarBaz
  }
}

fn main() {
    decide(foo::BarBar);
}

fn decide(bar: foo::Bars) -&gt; int {
    match bar {
        BarFoo =&gt; 0,
        BarBar =&gt; 42,
        BarBaz =&gt; 128
    }
}
</code></pre></div>
<p dir="auto">should fail to compile because it can't resolve the enum variants in the match statement.<br>
But currently it outputs this error message instead:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="match_namespace.rs:16:8: 16:17 error: unreachable pattern
match_namespace.rs:16         BarBar =&gt; 42,
                              ^~~~~~~~~
match_namespace.rs:17:8: 17:17 error: unreachable pattern
match_namespace.rs:17         BarBaz =&gt; 128
                              ^~~~~~~~~"><pre class="notranslate"><code class="notranslate">match_namespace.rs:16:8: 16:17 error: unreachable pattern
match_namespace.rs:16         BarBar =&gt; 42,
                              ^~~~~~~~~
match_namespace.rs:17:8: 17:17 error: unreachable pattern
match_namespace.rs:17         BarBaz =&gt; 128
                              ^~~~~~~~~
</code></pre></div>
<p dir="auto">Which is curious because it doesn't complaint about the <strong>first</strong> item in the match statement, and because it somehow confuses 'Don't know what it is' with 'Can't reach it'.</p>