<p dir="auto">While cargo was compiling <a href="https://github.com/reem/rust-traverse">traverse</a>, I encountered the error <code class="notranslate">thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0'</code>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ uname -rsm
Linux 3.13.0-24-generic x86_64

$ rustc --version --verbose
rustc 1.0.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.0.0-dev"><pre class="notranslate"><code class="notranslate">$ uname -rsm
Linux 3.13.0-24-generic x86_64

$ rustc --version --verbose
rustc 1.0.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.0.0-dev
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Compiling traverse v0.0.6
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 'index out of bounds: the len is 0 but the index is 0', /build/buildd/rust-nightly-201501310408~1d00c54~trusty/src/librustc/middle/infer/region_inference/mod.rs:1015"><pre class="notranslate"><code class="notranslate">Compiling traverse v0.0.6
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 'index out of bounds: the len is 0 but the index is 0', /build/buildd/rust-nightly-201501310408~1d00c54~trusty/src/librustc/middle/infer/region_inference/mod.rs:1015
</code></pre></div>
<p dir="auto">Backtrace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="stack backtrace:
   1:     0x7f52fa93e4d0 - sys::backtrace::write::hab6dd99acb511764H8t
   2:     0x7f52fa961840 - &lt;unknown&gt;
   3:     0x7f52fa8cde50 - rt::unwind::begin_unwind_inner::h3266fe1d96f60e3fAZA
   4:     0x7f52fa8ce970 - rt::unwind::begin_unwind_fmt::he5da4c6aaeb74bfa6XA
   5:     0x7f52fa9616a0 - rust_begin_unwind
   6:     0x7f52fa9a9a50 - panicking::panic_fmt::h18479da70a65102cARv
   7:     0x7f52fa9b2120 - panicking::panic_bounds_check::h3eb82e89c0e73253BQv
   8:     0x7f52f8ab4000 - &lt;unknown&gt;
   9:     0x7f52f8ab3c90 - middle::infer::region_inference::RegionVarBindings&lt;'a, 'tcx&gt;::resolve_regions::hf123a4c5108ce144Yyv
  10:     0x7f52f8ad3400 - middle::infer::InferCtxt&lt;'a, 'tcx&gt;::resolve_regions_and_report_errors::h70d3d0c25f8018a9d8z
  11:     0x7f52fa0a61a0 - &lt;unknown&gt;
  12:     0x7f52fa0ae7d0 - &lt;unknown&gt;
  13:     0x7f52fa0b4e20 - &lt;unknown&gt;
  14:     0x7f52fa0b4e20 - &lt;unknown&gt;
  15:     0x7f52fa17e550 - &lt;unknown&gt;
  16:     0x7f52fa179030 - check_crate::hcad51444396ed313IEz
  17:     0x7f52faec7b70 - driver::phase_3_run_analysis_passes::h7f0251bcf43e0862NFa
  18:     0x7f52faeaef50 - driver::compile_input::h10073932bcf4c3a9Bba
  19:     0x7f52faf74f50 - &lt;unknown&gt;
  20:     0x7f52faf735e0 - &lt;unknown&gt;
  21:     0x7f52faf72510 - &lt;unknown&gt;
  22:     0x7f52fa9cbe80 - &lt;unknown&gt;
  23:     0x7f52fa9cbe70 - rust_try
  24:     0x7f52faf727c0 - &lt;unknown&gt;
  25:     0x7f52fa94e010 - &lt;unknown&gt;
  26:     0x7f52f4cb20c0 - start_thread
  27:     0x7f52fa54dec9 - __clone
  28:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">stack backtrace:
   1:     0x7f52fa93e4d0 - sys::backtrace::write::hab6dd99acb511764H8t
   2:     0x7f52fa961840 - &lt;unknown&gt;
   3:     0x7f52fa8cde50 - rt::unwind::begin_unwind_inner::h3266fe1d96f60e3fAZA
   4:     0x7f52fa8ce970 - rt::unwind::begin_unwind_fmt::he5da4c6aaeb74bfa6XA
   5:     0x7f52fa9616a0 - rust_begin_unwind
   6:     0x7f52fa9a9a50 - panicking::panic_fmt::h18479da70a65102cARv
   7:     0x7f52fa9b2120 - panicking::panic_bounds_check::h3eb82e89c0e73253BQv
   8:     0x7f52f8ab4000 - &lt;unknown&gt;
   9:     0x7f52f8ab3c90 - middle::infer::region_inference::RegionVarBindings&lt;'a, 'tcx&gt;::resolve_regions::hf123a4c5108ce144Yyv
  10:     0x7f52f8ad3400 - middle::infer::InferCtxt&lt;'a, 'tcx&gt;::resolve_regions_and_report_errors::h70d3d0c25f8018a9d8z
  11:     0x7f52fa0a61a0 - &lt;unknown&gt;
  12:     0x7f52fa0ae7d0 - &lt;unknown&gt;
  13:     0x7f52fa0b4e20 - &lt;unknown&gt;
  14:     0x7f52fa0b4e20 - &lt;unknown&gt;
  15:     0x7f52fa17e550 - &lt;unknown&gt;
  16:     0x7f52fa179030 - check_crate::hcad51444396ed313IEz
  17:     0x7f52faec7b70 - driver::phase_3_run_analysis_passes::h7f0251bcf43e0862NFa
  18:     0x7f52faeaef50 - driver::compile_input::h10073932bcf4c3a9Bba
  19:     0x7f52faf74f50 - &lt;unknown&gt;
  20:     0x7f52faf735e0 - &lt;unknown&gt;
  21:     0x7f52faf72510 - &lt;unknown&gt;
  22:     0x7f52fa9cbe80 - &lt;unknown&gt;
  23:     0x7f52fa9cbe70 - rust_try
  24:     0x7f52faf727c0 - &lt;unknown&gt;
  25:     0x7f52fa94e010 - &lt;unknown&gt;
  26:     0x7f52f4cb20c0 - start_thread
  27:     0x7f52fa54dec9 - __clone
  28:                0x0 - &lt;unknown&gt;
</code></pre></div>
<p dir="auto">Attempting to compile <a href="https://github.com/reem/rust-traverse">https://github.com/reem/rust-traverse</a> with <code class="notranslate">cargo 0.0.1-pre-nightly (453ae9f 2015-01-29 00:56:56 +0000)</code> and <code class="notranslate">rustc 1.0.0-nightly (c5961ad06 2015-01-28 21:49:38 +0000)</code> yields the following ICE:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/infer/region_inference/mod.rs:1015

stack backtrace:
   1:     0x7f8da355a880 - sys::backtrace::write::h471f2f26c91df096Q8t
   2:     0x7f8da357df80 - failure::on_fail::h389257f46ebc50afikB
   3:     0x7f8da34ea220 - rt::unwind::begin_unwind_inner::haa1ac937607e9179jZA
   4:     0x7f8da34ead50 - rt::unwind::begin_unwind_fmt::ha84452bff441c4ffPXA
   5:     0x7f8da357dde0 - rust_begin_unwind
   6:     0x7f8da35c6ef0 - panicking::panic_fmt::ha791a233597f33dbBRv
   7:     0x7f8da35cf5c0 - panicking::panic_bounds_check::h7964adf489703576CQv
   8:     0x7f8da16d6ce0 - middle::infer::region_inference::RegionVarBindings&lt;'a, 'tcx&gt;::infer_variable_values::hdb795f883c676391mJw
   9:     0x7f8da16d6970 - middle::infer::region_inference::RegionVarBindings&lt;'a, 'tcx&gt;::resolve_regions::h2570f98c1810a795Ymw
  10:     0x7f8da16fc020 - middle::infer::InferCtxt&lt;'a, 'tcx&gt;::resolve_regions_and_report_errors::ha6a986062307cc873YA
  11:     0x7f8da2cc9b70 - check::compare_method::compare_impl_method::h33ae495a649fd66cIgk
  12:     0x7f8da2cd21a0 - check::check_item::hf11061a9881d4ad88ll
  13:     0x7f8da2cd87f0 - visit::walk_item::h17525548578187088888
  14:     0x7f8da2cd87f0 - visit::walk_item::h17525548578187088888
  15:     0x7f8da2da1ee0 - check_crate::closure.32081
  16:     0x7f8da2d9c9c0 - check_crate::he229bdeb8fdc745cDNy
  17:     0x7f8da3ae5d80 - driver::phase_3_run_analysis_passes::h2272be7454e1eb80NFa
  18:     0x7f8da3acd130 - driver::compile_input::hb694f278d4428f99Bba
  19:     0x7f8da3b91940 - run_compiler::hc3e25a8f6c4a1b50n9b
  20:     0x7f8da3b90050 - thunk::F.Invoke&lt;A, R&gt;::invoke::h8035325489603501466
  21:     0x7f8da3b8efb0 - rt::unwind::try::try_fn::h9312387582241745294
  22:     0x7f8da35e9320 - rust_try_inner
  23:     0x7f8da35e9310 - rust_try
  24:     0x7f8da3b8f260 - thunk::F.Invoke&lt;A, R&gt;::invoke::h8464768559817507673
  25:     0x7f8da356a770 - sys::thread::thread_start::he52b8673a3629881W3w
  26:     0x7f8d9d767fe0 - start_thread
  27:     0x7f8da316c859 - __clone
  28:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/infer/region_inference/mod.rs:1015

stack backtrace:
   1:     0x7f8da355a880 - sys::backtrace::write::h471f2f26c91df096Q8t
   2:     0x7f8da357df80 - failure::on_fail::h389257f46ebc50afikB
   3:     0x7f8da34ea220 - rt::unwind::begin_unwind_inner::haa1ac937607e9179jZA
   4:     0x7f8da34ead50 - rt::unwind::begin_unwind_fmt::ha84452bff441c4ffPXA
   5:     0x7f8da357dde0 - rust_begin_unwind
   6:     0x7f8da35c6ef0 - panicking::panic_fmt::ha791a233597f33dbBRv
   7:     0x7f8da35cf5c0 - panicking::panic_bounds_check::h7964adf489703576CQv
   8:     0x7f8da16d6ce0 - middle::infer::region_inference::RegionVarBindings&lt;'a, 'tcx&gt;::infer_variable_values::hdb795f883c676391mJw
   9:     0x7f8da16d6970 - middle::infer::region_inference::RegionVarBindings&lt;'a, 'tcx&gt;::resolve_regions::h2570f98c1810a795Ymw
  10:     0x7f8da16fc020 - middle::infer::InferCtxt&lt;'a, 'tcx&gt;::resolve_regions_and_report_errors::ha6a986062307cc873YA
  11:     0x7f8da2cc9b70 - check::compare_method::compare_impl_method::h33ae495a649fd66cIgk
  12:     0x7f8da2cd21a0 - check::check_item::hf11061a9881d4ad88ll
  13:     0x7f8da2cd87f0 - visit::walk_item::h17525548578187088888
  14:     0x7f8da2cd87f0 - visit::walk_item::h17525548578187088888
  15:     0x7f8da2da1ee0 - check_crate::closure.32081
  16:     0x7f8da2d9c9c0 - check_crate::he229bdeb8fdc745cDNy
  17:     0x7f8da3ae5d80 - driver::phase_3_run_analysis_passes::h2272be7454e1eb80NFa
  18:     0x7f8da3acd130 - driver::compile_input::hb694f278d4428f99Bba
  19:     0x7f8da3b91940 - run_compiler::hc3e25a8f6c4a1b50n9b
  20:     0x7f8da3b90050 - thunk::F.Invoke&lt;A, R&gt;::invoke::h8035325489603501466
  21:     0x7f8da3b8efb0 - rt::unwind::try::try_fn::h9312387582241745294
  22:     0x7f8da35e9320 - rust_try_inner
  23:     0x7f8da35e9310 - rust_try
  24:     0x7f8da3b8f260 - thunk::F.Invoke&lt;A, R&gt;::invoke::h8464768559817507673
  25:     0x7f8da356a770 - sys::thread::thread_start::he52b8673a3629881W3w
  26:     0x7f8d9d767fe0 - start_thread
  27:     0x7f8da316c859 - __clone
  28:                0x0 - &lt;unknown&gt;
</code></pre></div>