<p dir="auto">When using the try!() macro, directly on an iterator element. The compiler crashes, and fails to tell what is wrong with the code.</p>
<p dir="auto">I tried this code:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for try!(element) in elements {
// Do stuff here
}"><pre class="notranslate"><span class="pl-k">for</span> <span class="pl-en">try</span><span class="pl-en">!</span><span class="pl-kos">(</span>element<span class="pl-kos">)</span> <span class="pl-k">in</span> elements <span class="pl-kos">{</span>
<span class="pl-c">// Do stuff here</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Cargo crashed when attempting to compile the code. Commenting that part out, or removing the try!() call, caused the code to compile, so I think it is safe to assume that the "try!(element)" part is what is causing the issue.</p>
<h2 dir="auto">Meta</h2>
<p dir="auto"><code class="notranslate">rustc --version --verbose</code>:<br>
rustc 1.2.0 (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/082e4763615bdbe7b4dd3dfd6fc2210b7773edf5/hovercard" href="https://github.com/rust-lang/rust/commit/082e4763615bdbe7b4dd3dfd6fc2210b7773edf5"><tt>082e476</tt></a> 2015-08-03)<br>
binary: rustc<br>
commit-hash: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/082e4763615bdbe7b4dd3dfd6fc2210b7773edf5/hovercard" href="https://github.com/rust-lang/rust/commit/082e4763615bdbe7b4dd3dfd6fc2210b7773edf5"><tt>082e476</tt></a><br>
commit-date: 2015-08-03<br>
host: x86_64-apple-darwin<br>
release: 1.2.0</p>
<p dir="auto">Backtrace:</p>
<p dir="auto">Magnuss-MacBook-Air:stocks Magnus$ RUST_BACKTRACE=1 cargo build --verbose<br>
Fresh rustc-serialize v0.3.15<br>
Compiling stocks v0.1.0 (file:///Users/Magnus/MagnusUlf/Rust/stocks)<br>
Running <code class="notranslate">rustc src/main.rs --crate-name stocks --crate-type bin -g --out-dir /Users/Magnus/MagnusUlf/Rust/stocks/target/debug --emit=dep-info,link -L dependency=/Users/Magnus/MagnusUlf/Rust/stocks/target/debug -L dependency=/Users/Magnus/MagnusUlf/Rust/stocks/target/debug/deps --extern rustc_serialize=/Users/Magnus/MagnusUlf/Rust/stocks/target/debug/deps/librustc_serialize-c1e8163a38ed3d54.rlib</code><br>
error: internal compiler error: unexpected panic<br>
note: the compiler unexpectedly panicked. this is a bug.<br>
note: we would appreciate a bug report: <a href="https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports">https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports</a><br>
thread 'rustc' panicked at 'fold_mac disabled by default', ../src/libsyntax/fold.rs:190</p>
<p dir="auto">stack backtrace:<br>
1:        0x10d92c7b5 - sys::backtrace::write::hf5ea20500b66cd24uns<br>
2:        0x10d935013 - panicking::on_panic::hbe02cb0d925cad49iGw<br>
3:        0x10d8f0dd2 - rt::unwind::begin_unwind_inner::h12ba0ba9dffdecc2uow<br>
4:        0x10b59c1d6 - rt::unwind::begin_unwind::h2011421250315581831<br>
5:        0x10b807e8c - ptr::P::map::h3829385840473244073<br>
6:        0x10b7f808b - ext::expand::expand_expr::closure.64700<br>
7:        0x10b7f61b0 - ext::expand::expand_expr::h00bf5a43419a5a9b93a<br>
8:        0x10b846b90 - fold::noop_fold_stmt::h4092105005077979799<br>
9:        0x10b8228ae - ext::expand::expand_stmt::h8332ca149d4a1896QEb<br>
10:        0x10b84f4a3 - ext::expand::expand_block_elts::closure.65407<br>
11:        0x10b84f156 - iter::FlatMap&lt;I, U, F&gt;.Iterator::next::h7837221099035994564<br>
12:        0x10b84e067 - vec::Vec.FromIterator::from_iter::h4964964009179316507<br>
13:        0x10b84d66d - ext::expand::expand_block_elts::closure.65401<br>
14:        0x10b8098ea - ext::expand::expand_block_elts::h962105c93a5677c6MPb<br>
15:        0x10b84d322 - ext::expand::expand_block::ha3009aa3e00113ce7Ob<br>
16:        0x10b8092bc - ext::expand::expand_and_rename_fn_decl_and_block::h281d482393d5142bbjc<br>
17:        0x10b81085d - ext::expand::expand_item_underscore::h6f178e8b5a32d33fgtb<br>
18:        0x10b8744f4 - fold::Folder::fold_item_simple::h6794700446803303180<br>
19:        0x10b8740c3 - ptr::P::map::h1211983651740850239<br>
20:        0x10b80dd2d - ext::expand::expand_annotatable::hb4dbc2b7d2ec92e58Zb<br>
21:        0x10b809a71 - ext::expand::expand_item::h3540f4af8f7fd9f8Fsb<br>
22:        0x10b81697a - iter::FlatMap&lt;I, U, F&gt;.Iterator::next::h12102230822894758553<br>
23:        0x10b815887 - vec::Vec.FromIterator::from_iter::h16893642646688759245<br>
24:        0x10b81504f - fold::noop_fold_mod::h14542714455252956640<br>
25:        0x10b810fee - ext::expand::expand_item_underscore::h6f178e8b5a32d33fgtb<br>
26:        0x10b8744f4 - fold::Folder::fold_item_simple::h6794700446803303180<br>
27:        0x10b8740c3 - ptr::P::map::h1211983651740850239<br>
28:        0x10b80e7ad - ext::expand::expand_annotatable::hb4dbc2b7d2ec92e58Zb<br>
29:        0x10b809a71 - ext::expand::expand_item::h3540f4af8f7fd9f8Fsb<br>
30:        0x10b87d79f - ext::expand::expand_crate::ha5b4cf319725184aGrc<br>
31:        0x10a252402 - driver::phase_2_configure_and_expand::closure.21456<br>
32:        0x10a206822 - driver::phase_2_configure_and_expand::hcb65c5920cf60903ita<br>
33:        0x10a1f609d - driver::compile_input::hb6d2be5b0fa2247fTba<br>
34:        0x10a2d313f - run_compiler::h21d74b88eec3fe3bx7b<br>
35:        0x10a2d09f3 - boxed::F.FnBox::call_box::h1689969825914258414<br>
36:        0x10a2d01b7 - rt::unwind::try::try_fn::h11273853850686318048<br>
37:        0x10d9bfcc8 - rust_try_inner<br>
38:        0x10d9bfcb5 - rust_try<br>
39:        0x10d91ec95 - rt::unwind::try::inner_try::h480e3107f6a4b5b9nkw<br>
40:        0x10a2d03e8 - boxed::F.FnBox::call_box::h888215220722514405<br>
41:        0x10d933a9d - sys:<g-emoji class="g-emoji" alias="thread" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f9f5.png">🧵</g-emoji>:Thread:: new::thread_start::hdb3d925f69c5da4aHIv<br>
42:     0x7fff81f3b267 - _pthread_body<br>
43:     0x7fff81f3b1e4 - _pthread_start</p>
<p dir="auto">Could not compile <code class="notranslate">stocks</code>.</p>
<p dir="auto">Caused by:<br>
Process didn't exit successfully: <code class="notranslate">rustc src/main.rs --crate-name stocks --crate-type bin -g --out-dir /Users/Magnus/MagnusUlf/Rust/stocks/target/debug --emit=dep-info,link -L dependency=/Users/Magnus/MagnusUlf/Rust/stocks/target/debug -L dependency=/Users/Magnus/MagnusUlf/Rust/stocks/target/debug/deps --extern rustc_serialize=/Users/Magnus/MagnusUlf/Rust/stocks/target/debug/deps/librustc_serialize-c1e8163a38ed3d54.rlib</code> (exit code: 101)</p>
<p dir="auto">This is currently an error:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#[repr(C)]
enum Foo {
    Foo
}"><pre class="notranslate"><span class="pl-c1">#<span class="pl-kos">[</span>repr<span class="pl-kos">(</span><span class="pl-v">C</span><span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-k">enum</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-v">Foo</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">which is odd because it looks like a c-like enum. However it also looks like a univariant enum. We should specify which behaviour is correct.</p>
<p dir="auto">More generally, should this be considered a c-like enum, or should it be a univariant enum. This affects several other aspects of the compiler.</p>