<p dir="auto"><a href="https://play.rust-lang.org/?gist=23de822c03921663ae66&amp;version=nightly" rel="nofollow">https://play.rust-lang.org/?gist=23de822c03921663ae66&amp;version=nightly</a> .</p>
<p dir="auto">Error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:110:25: 110:60 error: cannot assign to `*entry` because it is borrowed
&lt;anon&gt;:110                         *entry = FragmentRepr::Enum(discrs);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:108:21: 111:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:112:64: 112:78 note: borrow of `*entry` occurs here
&lt;anon&gt;:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:112:64: 112:78 error: cannot borrow `entry.0` as mutable more than once at a time
&lt;anon&gt;:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:112:64: 112:78 note: previous borrow of `entry.0` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `entry.0` until the borrow ends
&lt;anon&gt;:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:150:6: 150:6 note: previous borrow ends here
&lt;anon&gt;:100     for &amp;move_path_index in paths {
...
&lt;anon&gt;:150     }
               ^
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `collections::vec::Vec&lt;(u32, FragmentRepr)&gt;`, right: `Box&lt;FragmentRepr&gt;`)', ../src/librustc_borrowck/borrowck/mod.rs:454"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:110:25: 110:60 error: cannot assign to `*entry` because it is borrowed
&lt;anon&gt;:110                         *entry = FragmentRepr::Enum(discrs);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:108:21: 111:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:112:64: 112:78 note: borrow of `*entry` occurs here
&lt;anon&gt;:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:112:64: 112:78 error: cannot borrow `entry.0` as mutable more than once at a time
&lt;anon&gt;:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:112:64: 112:78 note: previous borrow of `entry.0` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `entry.0` until the borrow ends
&lt;anon&gt;:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
&lt;anon&gt;:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
&lt;anon&gt;:100:5: 150:6 note: expansion site
&lt;anon&gt;:150:6: 150:6 note: previous borrow ends here
&lt;anon&gt;:100     for &amp;move_path_index in paths {
...
&lt;anon&gt;:150     }
               ^
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `collections::vec::Vec&lt;(u32, FragmentRepr)&gt;`, right: `Box&lt;FragmentRepr&gt;`)', ../src/librustc_borrowck/borrowck/mod.rs:454
</code></pre></div>
<p dir="auto">Code to reproduce here: <a href="https://github.com/toffaletti/borrow-crash">https://github.com/toffaletti/borrow-crash</a></p>
<p dir="auto"><code class="notranslate">rustc 1.2.0 (082e47636 2015-08-03)</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="stack backtrace:
   1:        0x103eb47b5 - sys::backtrace::write::hf5ea20500b66cd24uns
   2:        0x103ebd013 - panicking::on_panic::hbe02cb0d925cad49iGw
   3:        0x103e78dd2 - rt::unwind::begin_unwind_inner::h12ba0ba9dffdecc2uow
   4:        0x103e79b29 - rt::unwind::begin_unwind_fmt::hadf0dbf11d345ebfAnw
   5:        0x100c3568e - borrowck::LoanPath&lt;'tcx&gt;::common::h38c8ca06e07ec084irf
   6:        0x100c3366d - borrowck::check_loans::CheckLoanCtxt&lt;'a, 'tcx&gt;::report_error_if_loan_conflicts_with_restriction::h9e6281b29cbce21azGa
   7:        0x100c334fa - borrowck::check_loans::CheckLoanCtxt&lt;'a, 'tcx&gt;::report_error_if_loans_conflict::h9db6e8829e2a1ce8fEa
   8:        0x100c23250 - borrowck::check_loans::CheckLoanCtxt&lt;'a, 'tcx&gt;.euv..Delegate&lt;'tcx&gt;::borrow::hda5797bef3402e59Ria
   9:        0x100c2ad2c - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_pattern_::h14467536489201103802
  10:        0x100c2b5eb - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_pattern_::h14467536489201103802
  11:        0x100c2b12a - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_pattern_::h14467536489201103802
  12:        0x100c2a6e5 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_pat::h9458671995004733122
  13:        0x100c2f403 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  14:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  15:        0x100c2f649 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  16:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  17:        0x100c2f62e - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  18:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  19:        0x100c2f433 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  20:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  21:        0x100c4cb45 - borrowck::borrowck_fn::h1de21a9e0166e8daEPe
  22:        0x100c4c1d9 - borrowck::BorrowckCtxt&lt;'a, 'tcx&gt;.Visitor&lt;'v&gt;::visit_fn::h93ef453410da10bc2Ge
  23:        0x100c4eb14 - visit::walk_impl_item::h15300236788859175913
  24:        0x100c4f7ca - visit::walk_item::h3483642570553201847
  25:        0x100c4ec68 - borrowck::check_crate::h138dee6ce4dd468bHJe
  26:        0x1007998a1 - driver::phase_3_run_analysis_passes::closure.15766
  27:        0x100796204 - middle::ty::with_ctxt::h14728011725879770170
  28:        0x10079100a - driver::phase_3_run_analysis_passes::h16713467199444562124
  29:        0x100774107 - driver::compile_input::hb6d2be5b0fa2247fTba
  30:        0x10085013f - run_compiler::h21d74b88eec3fe3bx7b
  31:        0x10084d9f3 - boxed::F.FnBox&lt;A&gt;::call_box::h1689969825914258414
  32:        0x10084d1b7 - rt::unwind::try::try_fn::h11273853850686318048
  33:        0x103f47cc8 - rust_try_inner
  34:        0x103f47cb5 - rust_try
  35:        0x103ea6c95 - rt::unwind::try::inner_try::h480e3107f6a4b5b9nkw
  36:        0x10084d3e8 - boxed::F.FnBox&lt;A&gt;::call_box::h888215220722514405
  37:        0x103ebba9d - sys::thread::Thread::new::thread_start::hdb3d925f69c5da4aHIv
  38:     0x7fff8f7f8059 - _pthread_body
  39:     0x7fff8f7f7fd6 - _pthread_start"><pre class="notranslate"><code class="notranslate">stack backtrace:
   1:        0x103eb47b5 - sys::backtrace::write::hf5ea20500b66cd24uns
   2:        0x103ebd013 - panicking::on_panic::hbe02cb0d925cad49iGw
   3:        0x103e78dd2 - rt::unwind::begin_unwind_inner::h12ba0ba9dffdecc2uow
   4:        0x103e79b29 - rt::unwind::begin_unwind_fmt::hadf0dbf11d345ebfAnw
   5:        0x100c3568e - borrowck::LoanPath&lt;'tcx&gt;::common::h38c8ca06e07ec084irf
   6:        0x100c3366d - borrowck::check_loans::CheckLoanCtxt&lt;'a, 'tcx&gt;::report_error_if_loan_conflicts_with_restriction::h9e6281b29cbce21azGa
   7:        0x100c334fa - borrowck::check_loans::CheckLoanCtxt&lt;'a, 'tcx&gt;::report_error_if_loans_conflict::h9db6e8829e2a1ce8fEa
   8:        0x100c23250 - borrowck::check_loans::CheckLoanCtxt&lt;'a, 'tcx&gt;.euv..Delegate&lt;'tcx&gt;::borrow::hda5797bef3402e59Ria
   9:        0x100c2ad2c - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_pattern_::h14467536489201103802
  10:        0x100c2b5eb - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_pattern_::h14467536489201103802
  11:        0x100c2b12a - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_pattern_::h14467536489201103802
  12:        0x100c2a6e5 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_pat::h9458671995004733122
  13:        0x100c2f403 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  14:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  15:        0x100c2f649 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  16:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  17:        0x100c2f62e - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  18:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  19:        0x100c2f433 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::walk_expr::h982213050074646850
  20:        0x100c326a2 - middle::expr_use_visitor::ExprUseVisitor&lt;'d, 't, 'tcx, TYPER&gt;::consume_expr::h8840565628159227535
  21:        0x100c4cb45 - borrowck::borrowck_fn::h1de21a9e0166e8daEPe
  22:        0x100c4c1d9 - borrowck::BorrowckCtxt&lt;'a, 'tcx&gt;.Visitor&lt;'v&gt;::visit_fn::h93ef453410da10bc2Ge
  23:        0x100c4eb14 - visit::walk_impl_item::h15300236788859175913
  24:        0x100c4f7ca - visit::walk_item::h3483642570553201847
  25:        0x100c4ec68 - borrowck::check_crate::h138dee6ce4dd468bHJe
  26:        0x1007998a1 - driver::phase_3_run_analysis_passes::closure.15766
  27:        0x100796204 - middle::ty::with_ctxt::h14728011725879770170
  28:        0x10079100a - driver::phase_3_run_analysis_passes::h16713467199444562124
  29:        0x100774107 - driver::compile_input::hb6d2be5b0fa2247fTba
  30:        0x10085013f - run_compiler::h21d74b88eec3fe3bx7b
  31:        0x10084d9f3 - boxed::F.FnBox&lt;A&gt;::call_box::h1689969825914258414
  32:        0x10084d1b7 - rt::unwind::try::try_fn::h11273853850686318048
  33:        0x103f47cc8 - rust_try_inner
  34:        0x103f47cb5 - rust_try
  35:        0x103ea6c95 - rt::unwind::try::inner_try::h480e3107f6a4b5b9nkw
  36:        0x10084d3e8 - boxed::F.FnBox&lt;A&gt;::call_box::h888215220722514405
  37:        0x103ebba9d - sys::thread::Thread::new::thread_start::hdb3d925f69c5da4aHIv
  38:     0x7fff8f7f8059 - _pthread_body
  39:     0x7fff8f7f7fd6 - _pthread_start
</code></pre></div>