<p dir="auto">The following code builds and runs fine:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct S(i32);

static S0: S = S(0);

fn main() {
    let d = S0;

    println!(&quot;{}&quot;,
             match d {
                 S(0) =&gt; true,
                 _  =&gt; false,
             });
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">S</span><span class="pl-kos">(</span><span class="pl-smi">i32</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">static</span> <span class="pl-v">S0</span><span class="pl-kos">:</span> <span class="pl-smi">S</span> = <span class="pl-v">S</span><span class="pl-kos">(</span><span class="pl-c1">0</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> d = <span class="pl-v">S0</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">"{}"</span>,
             <span class="pl-k">match</span> d <span class="pl-kos">{</span>
                 <span class="pl-v">S</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">)</span> =&gt; <span class="pl-c1">true</span>,
                 _  =&gt; <span class="pl-c1">false</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">However attempting to match 'd' against 'S0' produces an error at the declaration of S0:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct S(i32);

static S0: S = S(0);

fn main() {
    let d = S0;

    println!(&quot;{}&quot;,
             match d {
                 S0 =&gt; true,
                 _  =&gt; false,
             });
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">S</span><span class="pl-kos">(</span><span class="pl-smi">i32</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">static</span> <span class="pl-v">S0</span><span class="pl-kos">:</span> <span class="pl-smi">S</span> = <span class="pl-v">S</span><span class="pl-kos">(</span><span class="pl-c1">0</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> d = <span class="pl-v">S0</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">"{}"</span>,
             <span class="pl-k">match</span> d <span class="pl-kos">{</span>
                 <span class="pl-v">S0</span> =&gt; <span class="pl-c1">true</span>,
                 _  =&gt; <span class="pl-c1">false</span>,
             <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="test.rs:3:16: 3:20 error: unsupported constant expr
test.rs:3 static S0: S = S(0);
                         ^~~~"><pre class="notranslate"><code class="notranslate">test.rs:3:16: 3:20 error: unsupported constant expr
test.rs:3 static S0: S = S(0);
                         ^~~~
</code></pre></div>
<p dir="auto">edited because it no longer ICEs.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub mod glfw {
    pub struct InputState(uint);

    pub static RELEASE  : InputState = InputState(0);
    pub static PRESS    : InputState = InputState(1);
    pub static REPEAT   : InputState = InputState(2);
}

fn action_to_str(state: glfw::InputState) -&gt; ~str {
    use glfw::{RELEASE, PRESS, REPEAT};
    match state {
        RELEASE =&gt; { ~&quot;Released&quot; }
        PRESS   =&gt; { ~&quot;Pressed&quot;  }
        REPEAT  =&gt; { ~&quot;Repeated&quot; }
        _       =&gt; { ~&quot;Unknown&quot;  }
    }
}

fn main() {}"><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">mod</span> glfw <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">struct</span> <span class="pl-smi">InputState</span><span class="pl-kos">(</span><span class="pl-smi">uint</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">RELEASE</span>  <span class="pl-kos">:</span> <span class="pl-smi">InputState</span> = <span class="pl-v">InputState</span><span class="pl-kos">(</span><span class="pl-c1">0</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">PRESS</span>    <span class="pl-kos">:</span> <span class="pl-smi">InputState</span> = <span class="pl-v">InputState</span><span class="pl-kos">(</span><span class="pl-c1">1</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">REPEAT</span>   <span class="pl-kos">:</span> <span class="pl-smi">InputState</span> = <span class="pl-v">InputState</span><span class="pl-kos">(</span><span class="pl-c1">2</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">action_to_str</span><span class="pl-kos">(</span><span class="pl-s1">state</span><span class="pl-kos">:</span> glfw<span class="pl-kos">::</span><span class="pl-smi">InputState</span><span class="pl-kos">)</span> -&gt; ~<span class="pl-smi">str</span> <span class="pl-kos">{</span>
    <span class="pl-k">use</span> glfw<span class="pl-kos">::</span><span class="pl-kos">{</span><span class="pl-v">RELEASE</span><span class="pl-kos">,</span> <span class="pl-v">PRESS</span><span class="pl-kos">,</span> <span class="pl-v">REPEAT</span><span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-k">match</span> state <span class="pl-kos">{</span>
        <span class="pl-v">RELEASE</span> =&gt; <span class="pl-kos">{</span> ~"<span class="pl-v">Released</span>" <span class="pl-kos">}</span>
        <span class="pl-v">PRESS</span>   =&gt; <span class="pl-kos">{</span> ~"<span class="pl-v">Pressed</span>"  <span class="pl-kos">}</span>
        <span class="pl-v">REPEAT</span>  =&gt; <span class="pl-kos">{</span> ~"<span class="pl-v">Repeated</span>" <span class="pl-kos">}</span>
        _       =&gt; <span class="pl-kos">{</span> ~"<span class="pl-v">Unknown</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-kos">}</span></pre></div>
<p dir="auto">Error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ice.rs:4:40: 4:53 error: unsupported constant expr
ice.rs:4     pub static RELEASE  : InputState = InputState(0);
                                                ^~~~~~~~~~~~~"><pre class="notranslate"><code class="notranslate">ice.rs:4:40: 4:53 error: unsupported constant expr
ice.rs:4     pub static RELEASE  : InputState = InputState(0);
                                                ^~~~~~~~~~~~~
</code></pre></div>