about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCarol (Nichols || Goulding) <carol.nichols@gmail.com>2017-10-25 11:29:14 -0400
committerCarol (Nichols || Goulding) <carol.nichols@gmail.com>2017-10-25 11:29:52 -0400
commit0e46cf4db4fdb8b2fd8cc0dde2425a16d478d8ed (patch)
treea06736d547d86372ae9aa12ddab4e4915d580530
parentb2478052f88db8c8526ee2dc4a382da91eefc76c (diff)
downloadrust-0e46cf4db4fdb8b2fd8cc0dde2425a16d478d8ed.tar.gz
rust-0e46cf4db4fdb8b2fd8cc0dde2425a16d478d8ed.zip
Reword to avoid using either re-assignment or reassignment in errors
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs2
-rw-r--r--src/librustc_mir/borrow_check.rs2
-rw-r--r--src/librustc_mir/util/borrowck_errors.rs2
-rw-r--r--src/test/compile-fail/asm-out-assign-imm.rs4
-rw-r--r--src/test/compile-fail/assign-imm-local-twice.rs4
-rw-r--r--src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs10
-rw-r--r--src/test/compile-fail/liveness-assign-imm-local-in-loop.rs4
-rw-r--r--src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs4
-rw-r--r--src/test/compile-fail/liveness-assign-imm-local-with-init.rs4
-rw-r--r--src/test/compile-fail/mut-pattern-internal-mutability.rs6
10 files changed, 21 insertions, 21 deletions
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index d29250ac57c..add128cc2cf 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -744,7 +744,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
         let mut err = self.cannot_reassign_immutable(span,
                                                      &self.loan_path_to_string(lp),
                                                      Origin::Ast);
-        err.span_label(span, "re-assignment of immutable variable");
+        err.span_label(span, "cannot assign twice to immutable variable");
         if span != assign.span {
             err.span_label(assign.span, format!("first assignment to `{}`",
                                               self.loan_path_to_string(lp)));
diff --git a/src/librustc_mir/borrow_check.rs b/src/librustc_mir/borrow_check.rs
index ff923ce259f..ee2ef00be57 100644
--- a/src/librustc_mir/borrow_check.rs
+++ b/src/librustc_mir/borrow_check.rs
@@ -1161,7 +1161,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
         self.tcx.cannot_reassign_immutable(span,
                                            &self.describe_lvalue(lvalue),
                                            Origin::Mir)
-                .span_label(span, "re-assignment of immutable variable")
+                .span_label(span, "cannot assign twice to immutable variable")
                 .span_label(assigned_span, format!("first assignment to `{}`",
                                                    self.describe_lvalue(lvalue)))
                 .emit();
diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs
index 216f6e44570..5451da2148e 100644
--- a/src/librustc_mir/util/borrowck_errors.rs
+++ b/src/librustc_mir/util/borrowck_errors.rs
@@ -232,7 +232,7 @@ pub trait BorrowckErrors {
                                  -> DiagnosticBuilder
     {
         struct_span_err!(self, span, E0384,
-                         "re-assignment of immutable variable `{}`{OGN}",
+                         "cannot assign twice to immutable variable `{}`{OGN}",
                          desc, OGN=o)
     }
 
diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/compile-fail/asm-out-assign-imm.rs
index 546d402252e..f2629fa52ff 100644
--- a/src/test/compile-fail/asm-out-assign-imm.rs
+++ b/src/test/compile-fail/asm-out-assign-imm.rs
@@ -27,8 +27,8 @@ pub fn main() {
     foo(x);
     unsafe {
         asm!("mov $1, $0" : "=r"(x) : "r"(5));
-        //~^ ERROR re-assignment of immutable variable `x`
-        //~| NOTE re-assignment of immutable
+        //~^ ERROR cannot assign twice to immutable variable `x`
+        //~| NOTE cannot assign twice to immutable
     }
     foo(x);
 }
diff --git a/src/test/compile-fail/assign-imm-local-twice.rs b/src/test/compile-fail/assign-imm-local-twice.rs
index 9a5d6289b58..5b3b7d44bd2 100644
--- a/src/test/compile-fail/assign-imm-local-twice.rs
+++ b/src/test/compile-fail/assign-imm-local-twice.rs
@@ -12,8 +12,8 @@ fn test() {
     let v: isize;
     v = 1; //~ NOTE first assignment
     println!("v={}", v);
-    v = 2; //~ ERROR re-assignment of immutable variable
-           //~| NOTE re-assignment of immutable
+    v = 2; //~ ERROR cannot assign twice to immutable variable
+           //~| NOTE cannot assign twice to immutable
     println!("v={}", v);
 }
 
diff --git a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs
index 3639db5cfc4..ea30911b3cc 100644
--- a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs
+++ b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs
@@ -26,7 +26,7 @@ struct S {
 pub fn main() {
     match 1 {
         x => {
-            x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
+            x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
                     //[mir]~^ ERROR (Mir) [E0384]
                     //[mir]~| ERROR (Ast) [E0384]
         }
@@ -34,7 +34,7 @@ pub fn main() {
 
     match E::Foo(1) {
         E::Foo(x) => {
-            x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
+            x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
                     //[mir]~^ ERROR (Mir) [E0384]
                     //[mir]~| ERROR (Ast) [E0384]
         }
@@ -42,7 +42,7 @@ pub fn main() {
 
     match (S { bar: 1 }) {
         S { bar: x } => {
-            x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
+            x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
                     //[mir]~^ ERROR (Mir) [E0384]
                     //[mir]~| ERROR (Ast) [E0384]
         }
@@ -50,7 +50,7 @@ pub fn main() {
 
     match (1,) {
         (x,) => {
-            x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
+            x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
                     //[mir]~^ ERROR (Mir) [E0384]
                     //[mir]~| ERROR (Ast) [E0384]
         }
@@ -58,7 +58,7 @@ pub fn main() {
 
     match [1,2,3] {
         [x,_,_] => {
-            x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
+            x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
                     //[mir]~^ ERROR (Mir) [E0384]
                     //[mir]~| ERROR (Ast) [E0384]
         }
diff --git a/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs b/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs
index 9d246f8ea5e..fa8f264eb5a 100644
--- a/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs
+++ b/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs
@@ -11,8 +11,8 @@
 fn test() {
     let v: isize;
     loop {
-        v = 1; //~ ERROR re-assignment of immutable variable
-        //~^ NOTE re-assignment of immutable variable
+        v = 1; //~ ERROR cannot assign twice to immutable variable
+        //~^ NOTE cannot assign twice to immutable variable
         v.clone(); // just to prevent liveness warnings
     }
 }
diff --git a/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs b/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs
index e1eb3246137..bfdd4347de7 100644
--- a/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs
+++ b/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs
@@ -11,8 +11,8 @@
 fn test() {
     let v: isize;
     v = 2;  //~ NOTE first assignment
-    v += 1; //~ ERROR re-assignment of immutable variable
-            //~| NOTE re-assignment of immutable
+    v += 1; //~ ERROR cannot assign twice to immutable variable
+            //~| NOTE cannot assign twice to immutable
     v.clone();
 }
 
diff --git a/src/test/compile-fail/liveness-assign-imm-local-with-init.rs b/src/test/compile-fail/liveness-assign-imm-local-with-init.rs
index 2468c91f34b..f35c1c69acd 100644
--- a/src/test/compile-fail/liveness-assign-imm-local-with-init.rs
+++ b/src/test/compile-fail/liveness-assign-imm-local-with-init.rs
@@ -11,8 +11,8 @@
 fn test() {
     let v: isize = 1; //~ NOTE first assignment
     v.clone();
-    v = 2; //~ ERROR re-assignment of immutable variable
-           //~| NOTE re-assignment of immutable
+    v = 2; //~ ERROR cannot assign twice to immutable variable
+           //~| NOTE cannot assign twice to immutable
     v.clone();
 }
 
diff --git a/src/test/compile-fail/mut-pattern-internal-mutability.rs b/src/test/compile-fail/mut-pattern-internal-mutability.rs
index 3a84bd6565e..1c7bc9d7303 100644
--- a/src/test/compile-fail/mut-pattern-internal-mutability.rs
+++ b/src/test/compile-fail/mut-pattern-internal-mutability.rs
@@ -15,9 +15,9 @@ fn main() {
     let foo = &mut 1;
 
     let &mut x = foo;
-    x += 1; //[ast]~ ERROR re-assignment of immutable variable
-            //[mir]~^ ERROR re-assignment of immutable variable `x` (Ast)
-            //[mir]~| ERROR re-assignment of immutable variable `x` (Mir)
+    x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+            //[mir]~^ ERROR cannot assign twice to immutable variable `x` (Ast)
+            //[mir]~| ERROR cannot assign twice to immutable variable `x` (Mir)
 
     // explicitly mut-ify internals
     let &mut mut x = foo;