]> git.lizzy.rs Git - rust.git/commitdiff
s/Second borrow/Previous borrow/ in error messages.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Tue, 17 Dec 2013 12:55:33 +0000 (20:55 +0800)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Tue, 17 Dec 2013 13:10:57 +0000 (21:10 +0800)
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 <ezyang@cs.stanford.edu>
src/librustc/middle/borrowck/check_loans.rs

index 6d4450ec2e00bac0aee1f487d4972ad65049c7dd..13c45cc8e36d2c9937375b52a7b6f3d4f7cd2aac 100644 (file)
@@ -238,7 +238,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                              self.bccx.loan_path_to_str(new_loan.loan_path)));
                     self.bccx.span_note(
                         old_loan.span,
-                        format!("second borrow of `{}` as mutable occurs here",
+                        format!("previous borrow of `{}` as mutable occurs here",
                              self.bccx.loan_path_to_str(new_loan.loan_path)));
                     return false;
                 }
@@ -253,7 +253,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                              self.bccx.mut_to_str(old_loan.mutbl)));
                     self.bccx.span_note(
                         old_loan.span,
-                        format!("second borrow of `{}` occurs here",
+                        format!("previous borrow of `{}` occurs here",
                              self.bccx.loan_path_to_str(new_loan.loan_path)));
                     return false;
                 }