Skip to content

ICE on external struct variant #19786

Closed
Closed
@KokaKiwi

Description

@KokaKiwi

By using xml-rs library on a project, I had a ICE when matching a struct variant for XML events.
I did some "code reduction" to get a minimal example of the bug.

Full log here: https://gist.github.com/cc5689c976714e5f6f03

UPDATE: Moved gist into the bug report

$ rustc --crate-type rlib ext.rs
$ rustc -L . --crate-type rlib lib.rs
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
task 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/option.rs:360

stack backtrace:
   1:     0x7f0b5d98b500 - rt::backtrace::imp::write::heed5901f9756dd23BOx
   2:     0x7f0b5d98e740 - failure::on_fail::ha44d264deefff4481fy
   3:     0x7f0b5d5dff30 - unwind::begin_unwind_inner::h8d953f2c1d079705CJc
   4:     0x7f0b5d5dfa30 - unwind::begin_unwind_fmt::hbd19a3b96951d460ZGc
   5:     0x7f0b5d5df9f0 - rust_begin_unwind
   6:     0x7f0b5d628430 - panicking::panic_fmt::h3f7fd7e307be735dRtl
   7:     0x7f0b5d626130 - panicking::panic::h666b719185178942hrl
   8:     0x7f0b5bc48f80 - middle::borrowck::move_data::fragments::add_fragment_siblings::h6999caa25c015a38sEg
   9:     0x7f0b5bc45fa0 - middle::borrowck::move_data::fragments::fixup_fragment_sets::hd2699c681cdada54Smg
  10:     0x7f0b5bc50170 - middle::borrowck::move_data::FlowedMoveData<'a, 'tcx>::new::haed7f1b248ae6bbaWMh
  11:     0x7f0b5bc5b0b0 - middle::borrowck::build_borrowck_dataflow_data::h464959412a7d843aQ6h
  12:     0x7f0b5bc58120 - middle::borrowck::borrowck_fn::he5b930fb1af0e36fZ3h
  13:     0x7f0b5bc5a1d0 - visit::walk_item::h3614721696940885168
  14:     0x7f0b5bc58f30 - visit::walk_mod::h6530408502505551912
  15:     0x7f0b5bc58930 - middle::borrowck::check_crate::h95dab899bf8d0bceFXh
  16:     0x7f0b5ddfcb10 - util::common::time::h18154370801334805047
  17:     0x7f0b5ddbd4d0 - driver::phase_3_run_analysis_passes::h4686c048b8307dc2Cta
  18:     0x7f0b5ddac260 - driver::compile_input::hf96889ff0bafd855pba
  19:     0x7f0b5de49070 - run_compiler::h9db34658886d7891EYb
  20:     0x7f0b5de48f60 - run::closure.21438
  21:     0x7f0b5de5a970 - task::TaskBuilder::try_future::closure.22892
  22:     0x7f0b5d963980 - task::TaskBuilder::spawn_internal::closure.30605
  23:     0x7f0b5d5ddbd0 - task::Task::spawn::closure.5728
  24:     0x7f0b5d63b250 - rust_try_inner
  25:     0x7f0b5d63b240 - rust_try
  26:     0x7f0b5d5ddcb0 - unwind::try::hf2f7fcf7ecc46c43Tyc
  27:     0x7f0b5d5dda70 - task::Task::run::h911f3b3bbb0c433efKb
  28:     0x7f0b5d5dd660 - task::Task::spawn::closure.5704
  29:     0x7f0b5d5df0b0 - thread::thread_start::h051da3e5b33a422fw1b
  30:     0x7f0b584ed250 - start_thread
  31:     0x7f0b5d2b4589 - clone
  32:                0x0 - <unknown>

ext.rs

pub enum Event {
    Element {
        name: String,
        attrs: Vec<String>,
    },
    Error,
} 

lib.rs

extern crate ext;

use ext::Event;

fn dispatch(e: Event) {
    match e {
        Event::Element {
            name: name,
            ..
        } => {
            println!("StartElement: {}", name);
        }
        _ => {}
    }
}
$ rustc --version=verbose
rustc 0.13.0-nightly (193390d0e 2014-12-11 22:56:54 +0000)
binary: rustc
commit-hash: 193390d0e48f6d8fb58acb7d0460c14acf907322
commit-date: 2014-12-11 22:56:54 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly 

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions