<p dir="auto">Given this rust:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class apple {
    let one_field_is_required: int;

    new() {
        self.one_field_is_required = 0;
        for [1,2,3].each |_x| {}
        // let _dummy = 4;
    }
}

fn main() {
}"><pre class="notranslate"><code class="notranslate">class apple {
    let one_field_is_required: int;

    new() {
        self.one_field_is_required = 0;
        for [1,2,3].each |_x| {}
        // let _dummy = 4;
    }
}

fn main() {
}
</code></pre></div>
<p dir="auto">rustc fails with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="test.rs:7:8: 7:32 error: mismatched types: expected `apple` but found `()` (class apple vs ())
test.rs:7         for [1,2,3].each |_x| {}
                  ^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">test.rs:7:8: 7:32 error: mismatched types: expected `apple` but found `()` (class apple vs ())
test.rs:7         for [1,2,3].each |_x| {}
                  ^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
</code></pre></div>
<p dir="auto">This is pretty wierd. Its like rustc thinks the for loop is an implicit return expression.</p>
<p dir="auto">Un-commenting the <code class="notranslate">let _dummy = 4;</code> line makes the code compile as expected.</p>
<p dir="auto">The compiler panics when you put an extern function inside a structure implementation.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct Dummy;
impl Dummy {
    pub extern fn printme() {
        println!(&quot;Hello...&quot;);
    }
}

fn main() {
    Dummy::printme();
}"><pre class="notranslate"><code class="notranslate">struct Dummy;
impl Dummy {
    pub extern fn printme() {
        println!("Hello...");
    }
}

fn main() {
    Dummy::printme();
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: f.abi == Rust || f.abi == RustCall', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/base.rs:2440"><pre class="notranslate"><code class="notranslate">error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: f.abi == Rust || f.abi == RustCall', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/base.rs:2440
</code></pre></div>
<p dir="auto">Try it: <a href="http://is.gd/MUQsZd" rel="nofollow">http://is.gd/MUQsZd</a></p>