<p dir="auto">Some code:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![crate_type=&quot;lib&quot;]

pub mod variant0 {
    pub enum A { A(()) }
    pub static B: A = A(());

    pub fn main() {
    }
}

#[cfg(variant1)]
pub mod variant1 {
    pub enum A { A(()) }
    pub static B: A = A(()); // &lt;-- error here ...

    // /tmp/s.rs:6:23: 6:28 error: unsupported constant expr
    // /tmp/s.rs:6     pub static B: A = A(());
    //                                  ^~~~~

    pub fn main() {
        match A(()) {
            B =&gt; (), // ... introduced by use of `B` here
            _ =&gt; (), }
    }
}

#[cfg(variant2)]
pub mod variant2 {
    pub enum C { D=3, E=4 }
    pub static F : C = D;

    pub fn main() {
        match D { F =&gt; (), _ =&gt; (), }
    }
}

pub mod variant3 {
    pub enum C { D=3, E=4 }
    pub static F : int = 3;

    pub fn main() {
        match D as int { F =&gt; (), _ =&gt; (), }
    }
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>crate_type=<span class="pl-s">"lib"</span><span class="pl-kos">]</span></span>

<span class="pl-k">pub</span> <span class="pl-k">mod</span> variant0 <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span> <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-kos">(</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">static</span> <span class="pl-v">B</span><span class="pl-kos">:</span> <span class="pl-smi">A</span> = <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-kos">(</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>
<span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>cfg<span class="pl-kos">(</span>variant1<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-k">pub</span> <span class="pl-k">mod</span> variant1 <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span> <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-kos">(</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">static</span> <span class="pl-v">B</span><span class="pl-kos">:</span> <span class="pl-smi">A</span> = <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;-- error here ...</span>

    <span class="pl-c">// /tmp/s.rs:6:23: 6:28 error: unsupported constant expr</span>
    <span class="pl-c">// /tmp/s.rs:6     pub static B: A = A(());</span>
    <span class="pl-c">//                                  ^~~~~</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-k">match</span> <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-v">B</span> =&gt; <span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-c">// ... introduced by use of `B` here</span>
            _ =&gt; <span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>cfg<span class="pl-kos">(</span>variant2<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-k">pub</span> <span class="pl-k">mod</span> variant2 <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">C</span> <span class="pl-kos">{</span> <span class="pl-v">D</span>=<span class="pl-c1">3</span><span class="pl-kos">,</span> <span class="pl-v">E</span>=<span class="pl-c1">4</span> <span class="pl-kos">}</span>
    <span class="pl-k">pub</span> <span class="pl-k">static</span> <span class="pl-v">F</span> <span class="pl-kos">:</span> <span class="pl-smi">C</span> = <span class="pl-v">D</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-k">match</span> <span class="pl-v">D</span> <span class="pl-kos">{</span> <span class="pl-v">F</span> =&gt; <span class="pl-kos">(</span><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>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">mod</span> variant3 <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">C</span> <span class="pl-kos">{</span> <span class="pl-v">D</span>=<span class="pl-c1">3</span><span class="pl-kos">,</span> <span class="pl-v">E</span>=<span class="pl-c1">4</span> <span class="pl-kos">}</span>
    <span class="pl-k">pub</span> <span class="pl-k">static</span> <span class="pl-v">F</span> <span class="pl-kos">:</span> <span class="pl-smi">int</span> = <span class="pl-c1">3</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-k">match</span> <span class="pl-v">D</span> <span class="pl-k">as</span> <span class="pl-smi">int</span> <span class="pl-kos">{</span> <span class="pl-v">F</span> =&gt; <span class="pl-kos">(</span><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>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Some funkiness:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% rustc /tmp/s.rs
% rustc --cfg variant1 /tmp/s.rs
/tmp/s.rs:14:23: 14:28 error: unsupported constant expr
/tmp/s.rs:14     pub static B: A = A(()); // &lt;-- error here ...
                                   ^~~~~
% rustc --cfg variant2 /tmp/s.rs
error: internal compiler error: only scalars and strings supported in compare_values
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /Users/fklock/Dev/Mozilla/rust.git/src/libsyntax/diagnostic.rs:155

%  "><pre class="notranslate"><code class="notranslate">% rustc /tmp/s.rs
% rustc --cfg variant1 /tmp/s.rs
/tmp/s.rs:14:23: 14:28 error: unsupported constant expr
/tmp/s.rs:14     pub static B: A = A(()); // &lt;-- error here ...
                                   ^~~~~
% rustc --cfg variant2 /tmp/s.rs
error: internal compiler error: only scalars and strings supported in compare_values
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /Users/fklock/Dev/Mozilla/rust.git/src/libsyntax/diagnostic.rs:155

%  
</code></pre></div>
<p dir="auto">The oddity in variant1, as noted in the comments, is that the use of <code class="notranslate">B</code> in a match pattern is causing the compiler to complain about its definition as a static item.</p>
<p dir="auto">The oddity in variant2 is that we hit an ICE.  :)</p>
<p dir="auto">When compiling</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="static val: [u8, ..1] = [0];

fn main() {
    match [1] {
        val =&gt; (),
        _ =&gt; ()
    }
}"><pre class="notranslate"><code class="notranslate">static val: [u8, ..1] = [0];

fn main() {
    match [1] {
        val =&gt; (),
        _ =&gt; ()
    }
}
</code></pre></div>
<p dir="auto">The error message</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc errormsg.rs 
errormsg.rs:1:25: 1:28 error: unsupported constant expr
errormsg.rs:1 static val: [u8, ..1] = [0];
                                      ^~~"><pre class="notranslate"><code class="notranslate">$ rustc errormsg.rs 
errormsg.rs:1:25: 1:28 error: unsupported constant expr
errormsg.rs:1 static val: [u8, ..1] = [0];
                                      ^~~
</code></pre></div>
<p dir="auto">points towards the definition of the constant and not the match statement which is misleading because the definition of the static value is perfectly fine but not its usage inside the match.</p>
<p dir="auto">I am using rust 0.10.</p>