Skip to content

Commit 4584acd

Browse files
committed
s/Second borrow/Previous borrow/ in error messages.
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 borrow (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]>
1 parent dc65762 commit 4584acd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
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)