Added better error message for shared borrow treated as unique for purposes of lifetimes

This commit is contained in:
PankajChaudhary5
2020-10-08 10:45:34 +05:30
parent d9985fc108
commit 50d9b30a37
8 changed files with 18 additions and 17 deletions

View File

@@ -68,9 +68,10 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
err.span_label(
new_loan_span,
format!(
"mutable borrow starts here in previous \
iteration of loop{}",
opt_via
"{}{} was mutably borrowed here in the previous iteration of the loop{}",
desc,
via(opt_via),
opt_via,
),
);
if let Some(old_load_end_span) = old_load_end_span {