Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected panic in rustc #27320

Closed
ludat opened this issue Jul 27, 2015 · 2 comments
Closed

unexpected panic in rustc #27320

ludat opened this issue Jul 27, 2015 · 2 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@ludat
Copy link

ludat commented Jul 27, 2015

I can't show just a snippet of code to crash rustc but I made an special branch in my project with (what I think) is the minimum code required to crash rustc.

This is the full version of the code: ludat/lurri@2ec3223
This is the trimmed down version: ludat/lurri@f0536dd

I suspect that the culprit is the expansion of the piece macro in the pattern matching in src/game.rs in line 11

Also here is the travis build failing

I expected to see this happen: not to crash

Instead, this happened: crashed

Meta

rustc --version --verbose:

rustc 1.3.0-nightly (be23d44a5 2015-07-20)
binary: rustc
commit-hash: be23d44a539deff16170d2af8fa10fb1cecc6a01
commit-date: 2015-07-20
host: x86_64-unknown-linux-gnu
release: 1.3.0-nightly

Backtrace:

   Compiling lurri v0.1.0 (file:///home/lucas/Proyects/lurri)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362

stack backtrace:
   1:     0x7fbf73d06a8e - sys::backtrace::write::h6fc6daa5f5106581vus
   2:     0x7fbf73d0ecb5 - panicking::on_panic::h2e630ece2d4363a7pgx
   3:     0x7fbf73cd01ae - rt::unwind::begin_unwind_inner::h3b68e45f925e19e53Vw
   4:     0x7fbf73cd0f06 - rt::unwind::begin_unwind_fmt::h9bdb324c84778b0b9Uw
   5:     0x7fbf73d0e856 - rust_begin_unwind
   6:     0x7fbf73d61124 - panicking::panic_fmt::h27a2c0209432b312ZeC
   7:     0x7fbf73d5aedd - panicking::panic::h667023ec9fe87f2bwdC
   8:     0x7fbf7346c2bd - check::_match::check_pat::h0d168aefbc0fec80C5a
   9:     0x7fbf73482600 - check::_match::check_struct_pat_fields::h7c929bbf30c9b687gSb
  10:     0x7fbf73480282 - check::_match::check_pat_struct::h41ddb16ab74ce8fc0Ab
  11:     0x7fbf7346ab3f - check::_match::check_pat::h0d168aefbc0fec80C5a
  12:     0x7fbf7348099a - check::_match::check_match::h9c69ab95d820ab93xvb
  13:     0x7fbf7352348e - check::check_expr_with_unifier::h8132546069841091851
  14:     0x7fbf734f89cb - check::check_block_with_expected::h7ab7a7c5f1768e05L0r
  15:     0x7fbf734dc23a - check::check_fn::h4d1836a8819fd7bfPFn
  16:     0x7fbf734f27c8 - check::check_bare_fn::hf12f7ee777ea52d1svn
  17:     0x7fbf734f09c5 - check::check_item_body::h6a336ec58ce21a885Vn
  18:     0x7fbf734f0ba2 - visit::walk_item::h197791554378392455
  19:     0x7fbf734f23ff - check::check_item_types::hc3810fbdd30cdc45Zsn
  20:     0x7fbf735afd5b - check_crate::haddd632d2e30ee4ffUC
  21:     0x7fbf7426aa39 - driver::phase_3_run_analysis_passes::closure.16350
  22:     0x7fbf7426937b - middle::ty::ctxt<'tcx>::create_and_enter::h4666070967497298580
  23:     0x7fbf74264351 - driver::phase_3_run_analysis_passes::h15678580448791110156
  24:     0x7fbf74248530 - driver::compile_input::h9f7bb33ca6460e8eTba
  25:     0x7fbf7432b983 - run_compiler::h3baa6f4aa1c94d08A7b
  26:     0x7fbf743293fe - boxed::F.FnBox<A>::call_box::h12363997576672449334
  27:     0x7fbf74328d39 - rt::unwind::try::try_fn::h13342136736031437153
  28:     0x7fbf73d89b08 - rust_try_inner
  29:     0x7fbf73d89af5 - rust_try
  30:     0x7fbf73cf9f17 - rt::unwind::try::inner_try::h39e7d773cdc65e57WRw
  31:     0x7fbf74328f4b - boxed::F.FnBox<A>::call_box::h8760475721745798250
  32:     0x7fbf73d0d8f1 - sys::thread::Thread::new::thread_start::h054a4d6de3e266d7J1v
  33:     0x7fbf6d931353 - start_thread
  34:     0x7fbf7396dbfc - __clone
  35:                0x0 - <unknown>

Other: running Arch linux (up to date to 2015-07-27) using the rust-nightly-bin package from the aur.

@mitaa
Copy link
Contributor

mitaa commented Jul 27, 2015

Reduced test case:

macro_rules! piece(
    ($piece:pat) => ($piece);
);

enum Piece {A, B}

fn main() {
    match Piece::A {
        piece!(pt@ Piece::A) | piece!(pt@ Piece::B) => {}
    }
}

@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 29, 2015
@steveklabnik
Copy link
Member

This no longer ICEs. If anyone would like to add a test case, please let me know and I'll be happy to help!

@steveklabnik steveklabnik added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 24, 2015
@apasel422 apasel422 mentioned this issue Oct 25, 2015
bors added a commit that referenced this issue Oct 25, 2015
Closes #22781.
Closes #23891.
Closes #24956.
Closes #25145.
Closes #25693.
Closes #26095.
Closes #26459.
Closes #27320.
Closes #27895.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants