<p dir="auto">Example here: <a href="http://is.gd/LKsPyZ" rel="nofollow">http://is.gd/LKsPyZ</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="enum Foo {
    Bar(u8)
}

fn main() {
    let x = Foo::Bar as u32;
    println!(&quot;{:?}&quot;, x);
}"><pre class="notranslate"><code class="notranslate">enum Foo {
    Bar(u8)
}

fn main() {
    let x = Foo::Bar as u32;
    println!("{:?}", x);
}
</code></pre></div>
<p dir="auto">In rust 1.0.0 stable, rustc prints "LLVM ERROR: expected relocatable expression"</p>
<p dir="auto">In nightly, it currently compiles and when run, the application prints "3964760960"</p>
<p dir="auto">rustc 0.13.0-dev (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/222ae8b9bb34b7f7b4fda11a4c6b643252ae5a8a/hovercard" href="https://github.com/rust-lang/rust/commit/222ae8b9bb34b7f7b4fda11a4c6b643252ae5a8a"><tt>222ae8b</tt></a> 2014-10-18 00:47:22 +0000)</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum Tag {
    Dynamic,
    Inline(u8),
    Static,
}

#[test]
fn f() {
    assert_eq!(Inline as uint, 1);
}"><pre class="notranslate"><span class="pl-k">enum</span> <span class="pl-smi">Tag</span> <span class="pl-kos">{</span>
    <span class="pl-v">Dynamic</span><span class="pl-kos">,</span>
    <span class="pl-v">Inline</span><span class="pl-kos">(</span><span class="pl-smi">u8</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-v">Static</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>test<span class="pl-kos">]</span></span>
<span class="pl-k">fn</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">assert_eq</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-v">Inline</span> <span class="pl-k">as</span> uint, <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">compiles and produces</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="task 'f' failed at 'assertion failed: `(left == right) &amp;&amp; (right == left)` (left: `140041300628448`, right: `1`)', foo.rs:9"><pre class="notranslate"><code class="notranslate">task 'f' failed at 'assertion failed: `(left == right) &amp;&amp; (right == left)` (left: `140041300628448`, right: `1`)', foo.rs:9
</code></pre></div>
<p dir="auto">I think it's casting the constructor function itself as a function pointer?  But this is <em>super</em> confusing behavior (caused a segfault in unsafe code) when I just refactored an enum to be not C-like and I want to get rid of remaining occurrences of <code class="notranslate">as uint</code>.</p>
<p dir="auto">Also it doesn't warn for <code class="notranslate">as u8</code>, even though it's too small for a function pointer.</p>