Skip to content

Commit f43402f

Browse files
committed
auto merge of #11025 : ezyang/rust/reword-second-borrow, r=cmr
When a borrow occurs twice illegally, Rust will label the other borrow as the "second borrow". This is quite confusing, as the "second borrow" usually happened before the flagged barrow (e.g. as far as dataflow is concerned, the first borrow is OK, the second borrow is illegal.) This patch renames "second borrow" to "previous borrow", to make the spatial relationship between the two borrows clearer. Signed-off-by: Edward Z. Yang <[email protected]>
2 parents 1fee5cd + 4584acd commit f43402f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc/middle/borrowck/check_loans.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<'a> CheckLoanCtxt<'a> {
238238
self.bccx.loan_path_to_str(new_loan.loan_path)));
239239
self.bccx.span_note(
240240
old_loan.span,
241-
format!("second borrow of `{}` as mutable occurs here",
241+
format!("previous borrow of `{}` as mutable occurs here",
242242
self.bccx.loan_path_to_str(new_loan.loan_path)));
243243
return false;
244244
}
@@ -253,7 +253,7 @@ impl<'a> CheckLoanCtxt<'a> {
253253
self.bccx.mut_to_str(old_loan.mutbl)));
254254
self.bccx.span_note(
255255
old_loan.span,
256-
format!("second borrow of `{}` occurs here",
256+
format!("previous borrow of `{}` occurs here",
257257
self.bccx.loan_path_to_str(new_loan.loan_path)));
258258
return false;
259259
}

0 commit comments

Comments
 (0)