From 86a7347fa1096688ff886d6bb92969ed7e20be9b Mon Sep 17 00:00:00 2001 From: Basile Desloges Date: Thu, 21 Sep 2017 16:29:54 +0200 Subject: [PATCH] mir-borrowck: Add borrow data parameter to `report_use_while_mutably_borrowed()` --- src/librustc_mir/borrow_check.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/borrow_check.rs b/src/librustc_mir/borrow_check.rs index 127ef1f0e0e..6ec01faf000 100644 --- a/src/librustc_mir/borrow_check.rs +++ b/src/librustc_mir/borrow_check.rs @@ -419,7 +419,7 @@ fn consume_lvalue(&mut self, self.each_borrow_involving_path( context, lvalue_span.0, flow_state, |this, _idx, borrow| { if !borrow.compatible_with(BorrowKind::Shared) { - this.report_use_while_mutably_borrowed(context, lvalue_span); + this.report_use_while_mutably_borrowed(context, lvalue_span, borrow); Control::Break } else { Control::Continue @@ -914,7 +914,8 @@ fn report_move_out_while_borrowed(&mut self, fn report_use_while_mutably_borrowed(&mut self, _context: Context, - (lvalue, span): (&Lvalue, Span)) { + (lvalue, span): (&Lvalue, Span), + borrow : &BorrowData) { let mut err = self.tcx.cannot_use_when_mutably_borrowed( span, &self.describe_lvalue(lvalue), Origin::Mir); // FIXME 1: add span_label for "borrow of `()` occurs here" -- 2.44.0