]> git.lizzy.rs Git - rust.git/commitdiff
use structured suggestion for "missing mut" label
authorAndy Russell <arussell123@gmail.com>
Wed, 12 Sep 2018 18:13:40 +0000 (14:13 -0400)
committerAndy Russell <arussell123@gmail.com>
Wed, 12 Sep 2018 21:16:18 +0000 (17:16 -0400)
Fixes #54133.

77 files changed:
src/librustc_borrowck/borrowck/mod.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/test/ui/E0596.ast.stderr
src/test/ui/asm/asm-out-assign-imm.nll.stderr
src/test/ui/assign-imm-local-twice.ast.nll.stderr
src/test/ui/assign-imm-local-twice.ast.stderr
src/test/ui/assign-imm-local-twice.mir.stderr
src/test/ui/assign-imm-local-twice.rs
src/test/ui/augmented-assignments.nll.stderr
src/test/ui/augmented-assignments.rs
src/test/ui/augmented-assignments.stderr
src/test/ui/borrowck/borrowck-access-permissions.ast.stderr
src/test/ui/borrowck/borrowck-argument.stderr
src/test/ui/borrowck/borrowck-asm.ast.nll.stderr
src/test/ui/borrowck/borrowck-asm.mir.stderr
src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr
src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr
src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr
src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr
src/test/ui/borrowck/borrowck-overloaded-call.stderr
src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr
src/test/ui/borrowck/borrowck-unboxed-closures.stderr
src/test/ui/borrowck/immutable-arg.stderr
src/test/ui/borrowck/mutability-errors.stderr
src/test/ui/borrowck/reassignment_immutable_fields.stderr
src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr
src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr
src/test/ui/codemap_tests/huge_multispan_highlight.stderr
src/test/ui/command-line-diagnostics.nll.stderr
src/test/ui/did_you_mean/issue-35937.stderr
src/test/ui/did_you_mean/issue-39544.stderr
src/test/ui/immut-function-arguments.ast.stderr
src/test/ui/issues/issue-36400.stderr
src/test/ui/issues/issue-45199.ast.nll.stderr
src/test/ui/issues/issue-45199.ast.stderr
src/test/ui/issues/issue-45199.mir.stderr
src/test/ui/issues/issue-45199.rs
src/test/ui/issues/issue-5500-1.ast.stderr
src/test/ui/issues/issue-5500-1.mir.stderr
src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr
src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs
src/test/ui/macros/span-covering-argument-1.stderr
src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr
src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr
src/test/ui/mut/mut-suggestion.nll.stderr
src/test/ui/mut/mut-suggestion.rs
src/test/ui/mut/mut-suggestion.stderr
src/test/ui/mut/mutable-class-fields.ast.stderr
src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr
src/test/ui/span/borrowck-object-mutability.stderr
src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr
src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr
src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr
src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr
src/test/ui/writing-to-immutable-vec.stderr

index ad45c5429a512b3214a1a6544673f471f2150a88..828364734f4a901b2c5de604da3c17fe58c71615 100644 (file)
@@ -45,7 +45,7 @@
 use std::hash::{Hash, Hasher};
 use syntax::ast;
 use syntax_pos::{MultiSpan, Span};
-use errors::{DiagnosticBuilder, DiagnosticId};
+use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
 
 use rustc::hir;
 use rustc::hir::intravisit::{self, Visitor};
@@ -1299,9 +1299,11 @@ fn note_immutable_local(&self,
                         snippet
                     );
                 } else {
-                    db.span_label(
+                    db.span_suggestion_with_applicability(
                         let_span,
-                        format!("consider changing this to `mut {}`", snippet),
+                        "make this binding mutable",
+                        format!("mut {}", snippet),
+                        Applicability::MachineApplicable,
                     );
                 }
             }
index 3f8cd03660c43ab6708420f79eb03509076453cf..27f700812d4793a8ced99f76869785cf2c57feec 100644 (file)
@@ -17,7 +17,7 @@
 use rustc::ty;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::sync::Lrc;
-use rustc_errors::DiagnosticBuilder;
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use syntax_pos::Span;
 
 use super::borrow_set::BorrowData;
@@ -690,9 +690,11 @@ pub(super) fn report_illegal_reassignment(
         if let Some(decl) = local_decl {
             if let Some(name) = decl.name {
                 if decl.can_be_made_mutable() {
-                    err.span_label(
+                    err.span_suggestion_with_applicability(
                         decl.source_info.span,
-                        format!("consider changing this to `mut {}`", name),
+                        "make this binding mutable",
+                        format!("mut {}", name),
+                        Applicability::MachineApplicable,
                     );
                 }
             }
index d88530b21647e9f775c5feffa704ebc160abbad2..6aec37d4972f351c328252a89c0b82449c044412 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
   --> $DIR/E0596.rs:16:18
    |
 LL |     let x = 1;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     let y = &mut x; //[ast]~ ERROR [E0596]
    |                  ^ cannot borrow mutably
 
index 45b0c84275be46ef203595a015511bd35870a775..7fefb6672c76bce79aad3017232d7173c49f639a 100644 (file)
@@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `x`
   --> $DIR/asm-out-assign-imm.rs:34:9
    |
 LL |     let x: isize;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x = 1;
    |     ----- first assignment to `x`
 ...
index 6d415eb733318108a18aa6d9a9f3ee6af596f3fa..8a50ec8f52c5844a34b1f3669114d0d5b5af5d4a 100644 (file)
@@ -1,9 +1,9 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/assign-imm-local-twice.rs:20:5
+  --> $DIR/assign-imm-local-twice.rs:21:5
    |
 LL |     let v: isize;
-   |         - consider changing this to `mut v`
-LL |     //[mir]~^ NOTE consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
+...
 LL |     v = 1; //[ast]~ NOTE first assignment
    |     ----- first assignment to `v`
 ...
index 32752621e149f0971befe8d0953720e5c8c9de20..a34ac54ae3bfad821742195c71c0535c1f812a2f 100644 (file)
@@ -1,5 +1,5 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/assign-imm-local-twice.rs:20:5
+  --> $DIR/assign-imm-local-twice.rs:21:5
    |
 LL |     v = 1; //[ast]~ NOTE first assignment
    |     ----- first assignment to `v`
index 6d415eb733318108a18aa6d9a9f3ee6af596f3fa..8a50ec8f52c5844a34b1f3669114d0d5b5af5d4a 100644 (file)
@@ -1,9 +1,9 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/assign-imm-local-twice.rs:20:5
+  --> $DIR/assign-imm-local-twice.rs:21:5
    |
 LL |     let v: isize;
-   |         - consider changing this to `mut v`
-LL |     //[mir]~^ NOTE consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
+...
 LL |     v = 1; //[ast]~ NOTE first assignment
    |     ----- first assignment to `v`
 ...
index ee9dafdd49eb86c897d6ed4672ff8dd0d54e5248..137414ccc6de01a87081e80bd5ea373c3eecfe0d 100644 (file)
@@ -13,7 +13,8 @@
 
 fn test() {
     let v: isize;
-    //[mir]~^ NOTE consider changing this to `mut v`
+    //[mir]~^ HELP make this binding mutable
+    //[mir]~| SUGGESTION mut v
     v = 1; //[ast]~ NOTE first assignment
            //[mir]~^ NOTE first assignment
     println!("v={}", v);
index 57a86227f764d104d6dfa82b593dbc80eeee2f81..64ac6883087dd9b00f5cd472bce8ba12439b53da 100644 (file)
@@ -15,11 +15,11 @@ LL | |     x;  //~ value moved here
    |       borrow later used here
 
 error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
-  --> $DIR/augmented-assignments.rs:30:5
+  --> $DIR/augmented-assignments.rs:31:5
    |
 LL |     let y = Int(2);
    |         - help: consider changing this to be mutable: `mut y`
-LL |     //~^ consider changing this to `mut y`
+...
 LL |     y   //~ error: cannot borrow immutable local variable `y` as mutable
    |     ^ cannot borrow as mutable
 
index 82f5c49eeb7ae520d81ccd85cdce3e14e01794df..2857ff2554a0c1f4e0c29ae8d7f37075896300c7 100644 (file)
@@ -26,7 +26,8 @@ fn main() {
     x;  //~ value moved here
 
     let y = Int(2);
-    //~^ consider changing this to `mut y`
+    //~^ HELP make this binding mutable
+    //~| SUGGESTION mut y
     y   //~ error: cannot borrow immutable local variable `y` as mutable
         //~| cannot borrow
     +=
index 953af813c3821d8e8dcd3c22af3deae23c8aa1e6..a7f3328071e26b370c93c6c778cbc64ab2cf7a34 100644 (file)
@@ -1,9 +1,9 @@
 error[E0596]: cannot borrow immutable local variable `y` as mutable
-  --> $DIR/augmented-assignments.rs:30:5
+  --> $DIR/augmented-assignments.rs:31:5
    |
 LL |     let y = Int(2);
-   |         - consider changing this to `mut y`
-LL |     //~^ consider changing this to `mut y`
+   |         - help: make this binding mutable: `mut y`
+...
 LL |     y   //~ error: cannot borrow immutable local variable `y` as mutable
    |     ^ cannot borrow mutably
 
index b17245673e02a646c5ad01929a7fdd4fb42016d6..c2ecdb33ba90715a21d2265d0f466b23037c4664 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
   --> $DIR/borrowck-access-permissions.rs:22:24
    |
 LL |     let x = 1;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |         let _y1 = &mut x; //[ast]~ ERROR [E0596]
    |                        ^ cannot borrow mutably
@@ -17,7 +17,7 @@ error[E0596]: cannot borrow immutable `Box` content `*box_x` as mutable
   --> $DIR/borrowck-access-permissions.rs:37:24
    |
 LL |         let box_x = Box::new(1);
-   |             ----- consider changing this to `mut box_x`
+   |             ----- help: make this binding mutable: `mut box_x`
 ...
 LL |         let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
    |                        ^^^^^^ cannot borrow as mutable
index 2a7a7b3ffeeae6f9979ef791445fcb1a7dec3cdc..7b8849ec764dd478972cf2d317cbbec190e8130b 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable
   --> $DIR/borrowck-argument.rs:20:5
    |
 LL | fn func(arg: S) {
-   |         --- consider changing this to `mut arg`
+   |         --- help: make this binding mutable: `mut arg`
 LL |     arg.mutate(); //~ ERROR: cannot borrow immutable argument
    |     ^^^ cannot borrow mutably
 
@@ -10,7 +10,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable
   --> $DIR/borrowck-argument.rs:25:9
    |
 LL |     fn method(&self, arg: S) {
-   |                      --- consider changing this to `mut arg`
+   |                      --- help: make this binding mutable: `mut arg`
 LL |         arg.mutate(); //~ ERROR: cannot borrow immutable argument
    |         ^^^ cannot borrow mutably
 
@@ -18,7 +18,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable
   --> $DIR/borrowck-argument.rs:31:9
    |
 LL |     fn default(&self, arg: S) {
-   |                       --- consider changing this to `mut arg`
+   |                       --- help: make this binding mutable: `mut arg`
 LL |         arg.mutate(); //~ ERROR: cannot borrow immutable argument
    |         ^^^ cannot borrow mutably
 
@@ -28,7 +28,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable
 LL |     (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument
    |       ---       ^^^ cannot borrow mutably
    |       |
-   |       consider changing this to `mut arg`
+   |       help: make this binding mutable: `mut arg`
 
 error: aborting due to 4 previous errors
 
index 6936d32a789717407243393bfcf1085d1704f868..b0f0535b9f6c7aefe768775756dc4bffe85f6d19 100644 (file)
@@ -28,7 +28,7 @@ LL |         let x = 3;
    |             -
    |             |
    |             first assignment to `x`
-   |             consider changing this to `mut x`
+   |             help: make this binding mutable: `mut x`
 LL |         unsafe {
 LL |             asm!("nop" : "=r"(x));  //[ast]~ ERROR cannot assign twice
    |             ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
@@ -40,7 +40,7 @@ LL |         let x = 3;
    |             -
    |             |
    |             first assignment to `x`
-   |             consider changing this to `mut x`
+   |             help: make this binding mutable: `mut x`
 LL |         unsafe {
 LL |             asm!("nop" : "+r"(x));  //[ast]~ ERROR cannot assign twice
    |             ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
index 6936d32a789717407243393bfcf1085d1704f868..b0f0535b9f6c7aefe768775756dc4bffe85f6d19 100644 (file)
@@ -28,7 +28,7 @@ LL |         let x = 3;
    |             -
    |             |
    |             first assignment to `x`
-   |             consider changing this to `mut x`
+   |             help: make this binding mutable: `mut x`
 LL |         unsafe {
 LL |             asm!("nop" : "=r"(x));  //[ast]~ ERROR cannot assign twice
    |             ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
@@ -40,7 +40,7 @@ LL |         let x = 3;
    |             -
    |             |
    |             first assignment to `x`
-   |             consider changing this to `mut x`
+   |             help: make this binding mutable: `mut x`
 LL |         unsafe {
 LL |             asm!("nop" : "+r"(x));  //[ast]~ ERROR cannot assign twice
    |             ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
index ca6b86e5ca686cafc27a10f9ca470dd2f4614199..a6338a22389a001cd28793b7cdd44d400f0ae154 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
   --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:25:5
    |
 LL |     let x = Foo { x: 3 };
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.printme();    //~ ERROR cannot borrow
    |     ^ cannot borrow mutably
 
index 9fc030f604c11a9e5d8d7da76a41e0ee1f7ef494..19a96d568575277b2a8ccaf1500e5ad5dc905442 100644 (file)
@@ -147,7 +147,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
   --> $DIR/borrowck-borrow-from-owned-ptr.rs:132:21
    |
 LL |     let foo = make_foo();
-   |         --- consider changing this to `mut foo`
+   |         --- help: make this binding mutable: `mut foo`
 LL |     let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                     ^^^^^^^^ cannot mutably borrow field of immutable binding
 
index cd0d6aa4ca3799354f8426764743d9af0d44c2b1..75f12c377edd440c481c46682c5d3c6d8561ea8e 100644 (file)
@@ -114,7 +114,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
   --> $DIR/borrowck-borrow-from-stack-variable.rs:130:21
    |
 LL |     let foo = make_foo();
-   |         --- consider changing this to `mut foo`
+   |         --- help: make this binding mutable: `mut foo`
 LL |     let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                     ^^^^^^^^ cannot mutably borrow field of immutable binding
 
index d852125a775d13d16f94b302f6dc89e8f0fc6c64..9f079b8cf98a9077da179b77a2f107f4cb6c7a7a 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable `Box` content `*a` as mutable
   --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:22:5
    |
 LL |     let a: Box<_> = box A;
-   |         - consider changing this to `mut a`
+   |         - help: make this binding mutable: `mut a`
 LL |     a.foo();
    |     ^ cannot borrow as mutable
 
index 0191e0765b382ef9e7a4790fb0bac2887a7a3426..2eeb4e433adf19ebc7428f43ac38ba4b6ee54a88 100644 (file)
@@ -5,7 +5,7 @@ LL |         x => {
    |         -
    |         |
    |         first assignment to `x`
-   |         consider changing this to `mut x`
+   |         help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -16,7 +16,7 @@ LL |         E::Foo(x) => {
    |                -
    |                |
    |                first assignment to `x`
-   |                consider changing this to `mut x`
+   |                help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -27,7 +27,7 @@ LL |         S { bar: x } => {
    |                  -
    |                  |
    |                  first assignment to `x`
-   |                  consider changing this to `mut x`
+   |                  help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -38,7 +38,7 @@ LL |         (x,) => {
    |          -
    |          |
    |          first assignment to `x`
-   |          consider changing this to `mut x`
+   |          help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -49,7 +49,7 @@ LL |         [x,_,_] => {
    |          -
    |          |
    |          first assignment to `x`
-   |          consider changing this to `mut x`
+   |          help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
index 0191e0765b382ef9e7a4790fb0bac2887a7a3426..2eeb4e433adf19ebc7428f43ac38ba4b6ee54a88 100644 (file)
@@ -5,7 +5,7 @@ LL |         x => {
    |         -
    |         |
    |         first assignment to `x`
-   |         consider changing this to `mut x`
+   |         help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -16,7 +16,7 @@ LL |         E::Foo(x) => {
    |                -
    |                |
    |                first assignment to `x`
-   |                consider changing this to `mut x`
+   |                help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -27,7 +27,7 @@ LL |         S { bar: x } => {
    |                  -
    |                  |
    |                  first assignment to `x`
-   |                  consider changing this to `mut x`
+   |                  help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -38,7 +38,7 @@ LL |         (x,) => {
    |          -
    |          |
    |          first assignment to `x`
-   |          consider changing this to `mut x`
+   |          help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
@@ -49,7 +49,7 @@ LL |         [x,_,_] => {
    |          -
    |          |
    |          first assignment to `x`
-   |          consider changing this to `mut x`
+   |          help: make this binding mutable: `mut x`
 LL |             x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
    |             ^^^^^^ cannot assign twice to immutable variable
 
index 0859a4e0f5550e159174622e9045661fa1f1d5a8..c073db2917a80a22bd759c3aefd0fc2a50c0953f 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
   --> $DIR/borrowck-mut-addr-of-imm-var.rs:13:30
    |
 LL |     let x: isize = 3;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     let y: &mut isize = &mut x; //~ ERROR cannot borrow
    |                              ^ cannot borrow mutably
 
index e2fd9d771f1aad3a51f6f5cce17ee700ecf9cd93..51b8ae83c6147e317ec6e97719dddfd9773d09ed 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable
   --> $DIR/borrowck-mut-slice-of-imm-vec.rs:17:16
    |
 LL |     let v = vec![1, 2, 3];
-   |         - consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
 LL |     write(&mut v); //~ ERROR cannot borrow
    |                ^ cannot borrow mutably
 
index 213d78339e2a4bfcef04efa06fb9a18096823485..fa2473adc2ffd14a5a5617b9b8772953bbae8140 100644 (file)
@@ -12,7 +12,7 @@ error[E0596]: cannot borrow immutable local variable `s` as mutable
   --> $DIR/borrowck-overloaded-call.rs:77:5
    |
 LL |     let s = SFnMut {
-   |         - consider changing this to `mut s`
+   |         - help: make this binding mutable: `mut s`
 ...
 LL |     s(3);   //~ ERROR cannot borrow immutable local variable `s` as mutable
    |     ^ cannot borrow mutably
index 2e2a1224306cb2c81426ee0bfde02063473d1f0c..520992096b5bc50e167a2da5c9fb624318d9d12d 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow field `(x as std::prelude::v1::Some).0` of immutable
   --> $DIR/borrowck-ref-mut-of-imm.rs:14:12
    |
 LL | fn destructure(x: Option<isize>) -> isize {
-   |                - consider changing this to `mut x`
+   |                - help: make this binding mutable: `mut x`
 ...
 LL |       Some(ref mut v) => *v //~ ERROR cannot borrow
    |            ^^^^^^^^^ cannot mutably borrow field of immutable binding
index 03b835d30770b99dfa52ddfbce5d3e4e62be1597..0c067c47004cfbe03b19236b070605bf20b7a75e 100644 (file)
@@ -12,7 +12,7 @@ error[E0596]: cannot borrow immutable argument `f` as mutable
   --> $DIR/borrowck-unboxed-closures.rs:17:5
    |
 LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) {
-   |                                      - consider changing this to `mut f`
+   |                                      - help: make this binding mutable: `mut f`
 LL |     f(1, 2);    //~ ERROR cannot borrow immutable argument
    |     ^ cannot borrow mutably
 
index 1cf68795bf07f5e3dc4101d9162eebdb259068ed..06ae5cdbcc63bac03f2e400fb818206c92d54b85 100644 (file)
@@ -10,7 +10,7 @@ error[E0384]: cannot assign to immutable argument `_x` (Mir)
   --> $DIR/immutable-arg.rs:14:5
    |
 LL | fn foo(_x: u32) {
-   |        -- consider changing this to `mut _x`
+   |        -- help: make this binding mutable: `mut _x`
 LL |     _x = 4;
    |     ^^^^^^ cannot assign to immutable argument
 
index d77254f31414b8251eb156c44680b3e3437b920d..5013f877e7ecb19ea72d9eb1b329d8e05b613f4d 100644 (file)
@@ -230,7 +230,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/mutability-errors.rs:64:10
    |
 LL | fn imm_local(x: (i32,)) {
-   |              - consider changing this to `mut x`
+   |              - help: make this binding mutable: `mut x`
 LL |     &mut x; //~ ERROR
    |          ^ cannot borrow mutably
 
@@ -238,7 +238,7 @@ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
   --> $DIR/mutability-errors.rs:65:10
    |
 LL | fn imm_local(x: (i32,)) {
-   |              - consider changing this to `mut x`
+   |              - help: make this binding mutable: `mut x`
 LL |     &mut x; //~ ERROR
 LL |     &mut x.0; //~ ERROR
    |          ^^^ cannot mutably borrow field of immutable binding
@@ -247,7 +247,7 @@ error[E0595]: closure cannot assign to immutable argument `x`
   --> $DIR/mutability-errors.rs:69:5
    |
 LL | fn imm_capture(x: (i32,)) {
-   |                - consider changing this to `mut x`
+   |                - help: make this binding mutable: `mut x`
 LL |     || { //~ ERROR
    |     ^^ cannot borrow mutably
 
index 54d12f8fae85d8ef419eb44010a0953a9ad8a18f..d16c0a5e37b8f9eba933bbb2e9ee6e2b33d02f52 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding
   --> $DIR/reassignment_immutable_fields.rs:17:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.0 = 1; //~ ERROR
    |     ^^^^^^^ cannot mutably borrow field of immutable binding
 
@@ -10,7 +10,7 @@ error[E0594]: cannot assign to field `x.1` of immutable binding
   --> $DIR/reassignment_immutable_fields.rs:18:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.0 = 1; //~ ERROR
 LL |     x.1 = 22; //~ ERROR
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
@@ -31,7 +31,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding
   --> $DIR/reassignment_immutable_fields.rs:25:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.0 = 1; //~ ERROR
    |     ^^^^^^^ cannot mutably borrow field of immutable binding
 
@@ -39,7 +39,7 @@ error[E0594]: cannot assign to field `x.1` of immutable binding
   --> $DIR/reassignment_immutable_fields.rs:26:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.0 = 1; //~ ERROR
 LL |     x.1 = 22; //~ ERROR
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
index 70849905f92ab84e1624c19063185e376e0b704f..b0b351889b79abd1b02059e35433d07525e092a7 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to field `x.a` of immutable binding
   --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5
    |
 LL |     let x: Foo;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.a = 1;  //~ ERROR
    |     ^^^^^^^ cannot mutably borrow field of immutable binding
 
@@ -10,7 +10,7 @@ error[E0594]: cannot assign to field `x.b` of immutable binding
   --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5
    |
 LL |     let x: Foo;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.a = 1;  //~ ERROR
 LL |     x.b = 22; //~ ERROR
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
index b3c013d8b1f493ce3801aae56d9c4bc6874ceb9d..65dff51059cefed5fb1e1ad7cd904b46e3849409 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding
   --> $DIR/reassignment_immutable_fields_twice.rs:17:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x = (22, 44);
 LL |     x.0 = 1; //~ ERROR
    |     ^^^^^^^ cannot mutably borrow field of immutable binding
@@ -11,7 +11,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding
   --> $DIR/reassignment_immutable_fields_twice.rs:22:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.0 = 1; //~ ERROR
    |     ^^^^^^^ cannot mutably borrow field of immutable binding
 
@@ -19,7 +19,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding
   --> $DIR/reassignment_immutable_fields_twice.rs:23:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     x.0 = 1; //~ ERROR
 LL |     x.0 = 22; //~ ERROR
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
@@ -28,7 +28,7 @@ error[E0594]: cannot assign to field `x.1` of immutable binding
   --> $DIR/reassignment_immutable_fields_twice.rs:24:5
    |
 LL |     let x: (u32, u32);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |     x.1 = 44; //~ ERROR
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
index 68818f50cd27393e50b639cd8356a033d5472d94..42eb1e9cb2193a2f46b4ccc44df4a240753cf07e 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
   --> $DIR/huge_multispan_highlight.rs:100:18
    |
 LL |     let x = "foo";
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |     let y = &mut x; //~ ERROR cannot borrow
    |                  ^ cannot borrow mutably
index 46bb7c5af5744f9da42d2156b3800196dfd7ec87..6273ba33e167b3ed7a2405e7587631814cc3da5b 100644 (file)
@@ -5,7 +5,7 @@ LL |     let x = 42;
    |         -
    |         |
    |         first assignment to `x`
-   |         consider changing this to `mut x`
+   |         help: make this binding mutable: `mut x`
 LL |     x = 43;
    |     ^^^^^^ cannot assign twice to immutable variable
 
index 4a29cd81425c4131a8456332052ac30778a363d6..591c3a0df0366792ccbd075ac7e926697dc99f67 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow field `f.v` of immutable binding as mutable
   --> $DIR/issue-35937.rs:17:5
    |
 LL |     let f = Foo { v: Vec::new() };
-   |         - consider changing this to `mut f`
+   |         - help: make this binding mutable: `mut f`
 LL |     f.v.push("cat".to_string()); //~ ERROR cannot borrow
    |     ^^^ cannot mutably borrow field of immutable binding
 
@@ -10,7 +10,7 @@ error[E0594]: cannot assign to field `s.x` of immutable binding
   --> $DIR/issue-35937.rs:26:5
    |
 LL |     let s = S { x: 42 };
-   |         - consider changing this to `mut s`
+   |         - help: make this binding mutable: `mut s`
 LL |     s.x += 1; //~ ERROR cannot assign
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
 
@@ -18,7 +18,7 @@ error[E0594]: cannot assign to field `s.x` of immutable binding
   --> $DIR/issue-35937.rs:30:5
    |
 LL | fn bar(s: S) {
-   |        - consider changing this to `mut s`
+   |        - help: make this binding mutable: `mut s`
 LL |     s.x += 1; //~ ERROR cannot assign
    |     ^^^^^^^^ cannot mutably borrow field of immutable binding
 
index dfa9cb880e56880f0351720b53355cdf49c61caa..7cf2ca720ef11bfb15dda7c50ead123b7e5f0d22 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
   --> $DIR/issue-39544.rs:21:18
    |
 LL |     let z = Z { x: X::Y };
-   |         - consider changing this to `mut z`
+   |         - help: make this binding mutable: `mut z`
 LL |     let _ = &mut z.x; //~ ERROR cannot borrow
    |                  ^^^ cannot mutably borrow field of immutable binding
 
@@ -77,7 +77,7 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable
   --> $DIR/issue-39544.rs:51:18
    |
 LL | pub fn with_arg(z: Z, w: &Z) {
-   |                 - consider changing this to `mut z`
+   |                 - help: make this binding mutable: `mut z`
 LL |     let _ = &mut z.x; //~ ERROR cannot borrow
    |                  ^^^ cannot mutably borrow field of immutable binding
 
index 54125b955cb1fdfad51881c48761e57a69af6db9..7b2061950f3dea16a9212eb3a338c04feb7e5b6b 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to immutable `Box` content `*y`
   --> $DIR/immut-function-arguments.rs:15:5
    |
 LL | fn f(y: Box<isize>) {
-   |      - consider changing this to `mut y`
+   |      - help: make this binding mutable: `mut y`
 LL |     *y = 5; //[ast]~ ERROR cannot assign
    |     ^^^^^^ cannot borrow as mutable
 
@@ -12,7 +12,7 @@ error[E0594]: cannot assign to immutable `Box` content `*q`
 LL |     let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
    |                  -                ^^^^^^ cannot borrow as mutable
    |                  |
-   |                  consider changing this to `mut q`
+   |                  help: make this binding mutable: `mut q`
 
 error: aborting due to 2 previous errors
 
index dbd6999b4f29fbb300c49f7f6c12db21f44e34d1..b0aadf3a51467c5bbd03dcc5a07e81741afcb16b 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
   --> $DIR/issue-36400.rs:15:12
    |
 LL |     let x = Box::new(3);
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 LL |     f(&mut *x); //~ ERROR cannot borrow immutable
    |            ^^ cannot borrow as mutable
 
index ce39776252b6ae25871f750044a33cc415fc3d71..3c7e92e2bc9ca6acbb7448a07debdef3d8a62043 100644 (file)
@@ -1,9 +1,9 @@
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:19:5
+  --> $DIR/issue-45199.rs:20:5
    |
 LL |     let b: Box<isize>;
-   |         - consider changing this to `mut b`
-LL |     //[mir]~^ NOTE consider changing this to `mut b`
+   |         - help: make this binding mutable: `mut b`
+...
 LL |     b = Box::new(1);    //[ast]~ NOTE first assignment
    |     - first assignment to `b`
 LL |                         //[mir]~^ NOTE first assignment
@@ -11,23 +11,23 @@ LL |     b = Box::new(2);    //[ast]~ ERROR cannot assign twice to immutable var
    |     ^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:29:5
+  --> $DIR/issue-45199.rs:31:5
    |
 LL |     let b = Box::new(1);    //[ast]~ NOTE first assignment
    |         -
    |         |
    |         first assignment to `b`
-   |         consider changing this to `mut b`
+   |         help: make this binding mutable: `mut b`
 ...
 LL |     b = Box::new(2);        //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign to immutable argument `b`
-  --> $DIR/issue-45199.rs:37:5
+  --> $DIR/issue-45199.rs:40:5
    |
 LL | fn test_args(b: Box<i32>) {  //[ast]~ NOTE first assignment
-   |              - consider changing this to `mut b`
-LL |                                 //[mir]~^ NOTE consider changing this to `mut b`
+   |              - help: make this binding mutable: `mut b`
+...
 LL |     b = Box::new(2);            //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^ cannot assign to immutable argument
 
index ff8f78b5116351cb11bd075f518d0a87d65873f4..cf8ceacca57ae54febb587f9a9a02194621fc26a 100644 (file)
@@ -1,5 +1,5 @@
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:19:5
+  --> $DIR/issue-45199.rs:20:5
    |
 LL |     b = Box::new(1);    //[ast]~ NOTE first assignment
    |     --------------- first assignment to `b`
@@ -8,7 +8,7 @@ LL |     b = Box::new(2);    //[ast]~ ERROR cannot assign twice to immutable var
    |     ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:29:5
+  --> $DIR/issue-45199.rs:31:5
    |
 LL |     let b = Box::new(1);    //[ast]~ NOTE first assignment
    |         - first assignment to `b`
@@ -17,11 +17,11 @@ LL |     b = Box::new(2);        //[ast]~ ERROR cannot assign twice to immutable
    |     ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:37:5
+  --> $DIR/issue-45199.rs:40:5
    |
 LL | fn test_args(b: Box<i32>) {  //[ast]~ NOTE first assignment
    |              - first assignment to `b`
-LL |                                 //[mir]~^ NOTE consider changing this to `mut b`
+...
 LL |     b = Box::new(2);            //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
 
index ce39776252b6ae25871f750044a33cc415fc3d71..3c7e92e2bc9ca6acbb7448a07debdef3d8a62043 100644 (file)
@@ -1,9 +1,9 @@
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:19:5
+  --> $DIR/issue-45199.rs:20:5
    |
 LL |     let b: Box<isize>;
-   |         - consider changing this to `mut b`
-LL |     //[mir]~^ NOTE consider changing this to `mut b`
+   |         - help: make this binding mutable: `mut b`
+...
 LL |     b = Box::new(1);    //[ast]~ NOTE first assignment
    |     - first assignment to `b`
 LL |                         //[mir]~^ NOTE first assignment
@@ -11,23 +11,23 @@ LL |     b = Box::new(2);    //[ast]~ ERROR cannot assign twice to immutable var
    |     ^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/issue-45199.rs:29:5
+  --> $DIR/issue-45199.rs:31:5
    |
 LL |     let b = Box::new(1);    //[ast]~ NOTE first assignment
    |         -
    |         |
    |         first assignment to `b`
-   |         consider changing this to `mut b`
+   |         help: make this binding mutable: `mut b`
 ...
 LL |     b = Box::new(2);        //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign to immutable argument `b`
-  --> $DIR/issue-45199.rs:37:5
+  --> $DIR/issue-45199.rs:40:5
    |
 LL | fn test_args(b: Box<i32>) {  //[ast]~ NOTE first assignment
-   |              - consider changing this to `mut b`
-LL |                                 //[mir]~^ NOTE consider changing this to `mut b`
+   |              - help: make this binding mutable: `mut b`
+...
 LL |     b = Box::new(2);            //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^ cannot assign to immutable argument
 
index 61e19ffc0d293b7db19a27131db79728eddaecb5..90a4960cb63f71635334a26ceaac877f4b55cbc2 100644 (file)
@@ -13,7 +13,8 @@
 
 fn test_drop_replace() {
     let b: Box<isize>;
-    //[mir]~^ NOTE consider changing this to `mut b`
+    //[mir]~^ HELP make this binding mutable
+    //[mir]~| SUGGESTION mut b
     b = Box::new(1);    //[ast]~ NOTE first assignment
                         //[mir]~^ NOTE first assignment
     b = Box::new(2);    //[ast]~ ERROR cannot assign twice to immutable variable
@@ -25,7 +26,8 @@ fn test_drop_replace() {
 fn test_call() {
     let b = Box::new(1);    //[ast]~ NOTE first assignment
                             //[mir]~^ NOTE first assignment
-                            //[mir]~| NOTE consider changing this to `mut b`
+                            //[mir]~| HELP make this binding mutable
+                            //[mir]~| SUGGESTION mut b
     b = Box::new(2);        //[ast]~ ERROR cannot assign twice to immutable variable
                             //[mir]~^ ERROR cannot assign twice to immutable variable `b`
                             //[ast]~| NOTE cannot assign twice to immutable
@@ -33,7 +35,8 @@ fn test_call() {
 }
 
 fn test_args(b: Box<i32>) {  //[ast]~ NOTE first assignment
-                                //[mir]~^ NOTE consider changing this to `mut b`
+                                //[mir]~^ HELP make this binding mutable
+                                //[mir]~| SUGGESTION mut b
     b = Box::new(2);            //[ast]~ ERROR cannot assign twice to immutable variable
                                 //[mir]~^ ERROR cannot assign to immutable argument `b`
                                 //[ast]~| NOTE cannot assign twice to immutable
index 611eea533b29692be2a21a946767ea2409e6da45..5ea18af7c68001cb39c15ff7874b4ce8eb02c510 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to field `_iter.node` of immutable binding
   --> $DIR/issue-5500-1.rs:22:5
    |
 LL |       let _iter = TrieMapIterator{node: &a};
-   |           ----- consider changing this to `mut _iter`
+   |           ----- help: make this binding mutable: `mut _iter`
 LL | /     _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
 LL | |                    //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
 LL | |                    // MIR doesn't generate an error because the code isn't reachable. This is OK
index 465485e5e290c58afdfab0c5781a2b35371b78b0..5cb72794961d1ae24e6b28cde055eb2bdc8b9a70 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to field `_iter.node` of immutable binding (Ast)
   --> $DIR/issue-5500-1.rs:22:5
    |
 LL |       let _iter = TrieMapIterator{node: &a};
-   |           ----- consider changing this to `mut _iter`
+   |           ----- help: make this binding mutable: `mut _iter`
 LL | /     _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
 LL | |                    //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
 LL | |                    // MIR doesn't generate an error because the code isn't reachable. This is OK
index 749b576092967e9553dd99172c1fe7a1a7b1fa60..1a5f788e1436816a5113c878771e50d5a0373eeb 100644 (file)
@@ -12,7 +12,7 @@ error[E0384]: cannot assign to immutable argument `y`
   --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
    |
 LL | fn foo(mut x: Ref, y: &u32) {
-   |                    - consider changing this to `mut y`
+   |                    - help: make this binding mutable: `mut y`
 LL |     y = x.b; //~ ERROR lifetime mismatch
    |     ^^^^^^^ cannot assign to immutable argument
 
index 0620235371a3928126d3037102188b5002ed61b6..fd3ae53d6eda5a9fd28296827ffcdf2b2e8732a2 100644 (file)
@@ -33,7 +33,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir)
   --> $DIR/liveness-assign-imm-local-notes.rs:23:9
    |
 LL |     let x;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |         x = 2;
    |         ----- first assignment to `x`
@@ -44,7 +44,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir)
   --> $DIR/liveness-assign-imm-local-notes.rs:35:13
    |
 LL |         let x;
-   |             - consider changing this to `mut x`
+   |             - help: make this binding mutable: `mut x`
 ...
 LL |             x = 2;
    |             ----- first assignment to `x`
@@ -55,7 +55,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir)
   --> $DIR/liveness-assign-imm-local-notes.rs:45:13
    |
 LL |     let x;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |             x = 1;      //~ ERROR (Ast) [E0384]
    |             ^^^^^ cannot assign twice to immutable variable
@@ -64,7 +64,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir)
   --> $DIR/liveness-assign-imm-local-notes.rs:48:13
    |
 LL |     let x;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |             x = 1;      //~ ERROR (Ast) [E0384]
    |             ----- first assignment to `x`
index 58a76bd2cf385e463d2924a438acf5000f30db5d..b23225adbb4a0de61882189d14cdf2efcb80f19b 100644 (file)
@@ -1,8 +1,8 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-in-loop.rs:18:9
+  --> $DIR/liveness-assign-imm-local-in-loop.rs:19:9
    |
 LL |     let v: isize;
-   |         - consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
 ...
 LL |         v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
    |         ^^^^^ cannot assign twice to immutable variable
index 54419fd5b256cbbabd4f3fc8d6a6d9da11f3db31..54135ca78eaa8b3f4f52f7d09a4b71225bdf901e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-in-loop.rs:18:9
+  --> $DIR/liveness-assign-imm-local-in-loop.rs:19:9
    |
 LL |         v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
    |         ^^^^^ cannot assign twice to immutable variable
index 58a76bd2cf385e463d2924a438acf5000f30db5d..b23225adbb4a0de61882189d14cdf2efcb80f19b 100644 (file)
@@ -1,8 +1,8 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-in-loop.rs:18:9
+  --> $DIR/liveness-assign-imm-local-in-loop.rs:19:9
    |
 LL |     let v: isize;
-   |         - consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
 ...
 LL |         v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
    |         ^^^^^ cannot assign twice to immutable variable
index 7bc3680ca772343b51bafa75f343847445487c0d..6f44d67e823dde94587447b0a802b31af7c8a238 100644 (file)
@@ -13,7 +13,8 @@
 
 fn test() {
     let v: isize;
-    //[mir]~^ NOTE consider changing this to `mut v`
+    //[mir]~^ HELP make this binding mutable
+    //[mir]~| SUGGESTION mut v
     loop {
         v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
                //[mir]~^ ERROR cannot assign twice to immutable variable `v`
index 091547ed1228a85fbb709a5de7fbd04ebc163f68..3dabbcb816b01408d59101a494198aedf6ef7db3 100644 (file)
@@ -1,9 +1,9 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-in-op-eq.rs:19:5
+  --> $DIR/liveness-assign-imm-local-in-op-eq.rs:20:5
    |
 LL |     let v: isize;
-   |         - consider changing this to `mut v`
-LL |     //[mir]~^ NOTE consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
+...
 LL |     v = 2;  //[ast]~ NOTE first assignment
    |     ----- first assignment to `v`
 LL |             //[mir]~^ NOTE first assignment
index a98c3c29bd2e83cff9daaa5c6927b1277239c883..266fb63c7c775741e85dc008fe79693f103284db 100644 (file)
@@ -1,5 +1,5 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-in-op-eq.rs:19:5
+  --> $DIR/liveness-assign-imm-local-in-op-eq.rs:20:5
    |
 LL |     v = 2;  //[ast]~ NOTE first assignment
    |     ----- first assignment to `v`
index 091547ed1228a85fbb709a5de7fbd04ebc163f68..3dabbcb816b01408d59101a494198aedf6ef7db3 100644 (file)
@@ -1,9 +1,9 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-in-op-eq.rs:19:5
+  --> $DIR/liveness-assign-imm-local-in-op-eq.rs:20:5
    |
 LL |     let v: isize;
-   |         - consider changing this to `mut v`
-LL |     //[mir]~^ NOTE consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
+...
 LL |     v = 2;  //[ast]~ NOTE first assignment
    |     ----- first assignment to `v`
 LL |             //[mir]~^ NOTE first assignment
index 7812cdd8684f6c773599909581afcb7db2c2498e..f585da8a3a5eaa54dd6530d7ac658b04b8c9580d 100644 (file)
@@ -13,7 +13,8 @@
 
 fn test() {
     let v: isize;
-    //[mir]~^ NOTE consider changing this to `mut v`
+    //[mir]~^ HELP make this binding mutable
+    //[mir]~| SUGGESTION mut v
     v = 2;  //[ast]~ NOTE first assignment
             //[mir]~^ NOTE first assignment
     v += 1; //[ast]~ ERROR cannot assign twice to immutable variable
index e954b1f5e0f8b9b3ee9592fe8ffd62a41017bc17..4a2b3b5d5fe47a350d1be72a8445528d73040637 100644 (file)
@@ -1,11 +1,11 @@
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/liveness-assign-imm-local-with-drop.rs:19:5
+  --> $DIR/liveness-assign-imm-local-with-drop.rs:20:5
    |
 LL |     let b = Box::new(1); //[ast]~ NOTE first assignment
    |         -
    |         |
    |         first assignment to `b`
-   |         consider changing this to `mut b`
+   |         help: make this binding mutable: `mut b`
 ...
 LL |     b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^ cannot assign twice to immutable variable
index 6abcf175f488a671abe77a517046a8080b0c3a3e..94799d919ae8c67e06d893f423de69ce52e9b6eb 100644 (file)
@@ -1,5 +1,5 @@
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/liveness-assign-imm-local-with-drop.rs:19:5
+  --> $DIR/liveness-assign-imm-local-with-drop.rs:20:5
    |
 LL |     let b = Box::new(1); //[ast]~ NOTE first assignment
    |         - first assignment to `b`
index e954b1f5e0f8b9b3ee9592fe8ffd62a41017bc17..4a2b3b5d5fe47a350d1be72a8445528d73040637 100644 (file)
@@ -1,11 +1,11 @@
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/liveness-assign-imm-local-with-drop.rs:19:5
+  --> $DIR/liveness-assign-imm-local-with-drop.rs:20:5
    |
 LL |     let b = Box::new(1); //[ast]~ NOTE first assignment
    |         -
    |         |
    |         first assignment to `b`
-   |         consider changing this to `mut b`
+   |         help: make this binding mutable: `mut b`
 ...
 LL |     b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^ cannot assign twice to immutable variable
index bb61a9037d906c9b80939e26350de5ca426c5b64..c32d2c4bb0f757084beb41c4442b1fe3b3d0a129 100644 (file)
@@ -14,7 +14,8 @@
 fn test() {
     let b = Box::new(1); //[ast]~ NOTE first assignment
                          //[mir]~^ NOTE first assignment
-                         //[mir]~| NOTE consider changing this to `mut b`
+                         //[mir]~| HELP make this binding mutable
+                         //[mir]~| SUGGESTION mut b
     drop(b);
     b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
                      //[mir]~^ ERROR cannot assign twice to immutable variable `b`
index 70a6ab3edf80318f925113fc30d9679f7ac40fe6..6137c9f5882d5b5fc2b962935fcdd465cae5bfdb 100644 (file)
@@ -1,11 +1,11 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-with-init.rs:19:5
+  --> $DIR/liveness-assign-imm-local-with-init.rs:20:5
    |
 LL |     let v: isize = 1; //[ast]~ NOTE first assignment
    |         -
    |         |
    |         first assignment to `v`
-   |         consider changing this to `mut v`
+   |         help: make this binding mutable: `mut v`
 ...
 LL |     v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^^^^^ cannot assign twice to immutable variable
index 47c780e83e8c208e4f9c0dcb1396249462d66ab8..d48608684a25be1b9ff73f135100f0ab936c9e2e 100644 (file)
@@ -1,5 +1,5 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-with-init.rs:19:5
+  --> $DIR/liveness-assign-imm-local-with-init.rs:20:5
    |
 LL |     let v: isize = 1; //[ast]~ NOTE first assignment
    |         - first assignment to `v`
index 70a6ab3edf80318f925113fc30d9679f7ac40fe6..6137c9f5882d5b5fc2b962935fcdd465cae5bfdb 100644 (file)
@@ -1,11 +1,11 @@
 error[E0384]: cannot assign twice to immutable variable `v`
-  --> $DIR/liveness-assign-imm-local-with-init.rs:19:5
+  --> $DIR/liveness-assign-imm-local-with-init.rs:20:5
    |
 LL |     let v: isize = 1; //[ast]~ NOTE first assignment
    |         -
    |         |
    |         first assignment to `v`
-   |         consider changing this to `mut v`
+   |         help: make this binding mutable: `mut v`
 ...
 LL |     v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^^^^^ cannot assign twice to immutable variable
index 672e9fab83743b8bf7b668fa17029850878ace20..158eb7d428cbc8b9ad4d13b801f1532311f2f9fb 100644 (file)
@@ -14,7 +14,8 @@
 fn test() {
     let v: isize = 1; //[ast]~ NOTE first assignment
                       //[mir]~^ NOTE first assignment
-                      //[mir]~| NOTE consider changing this to `mut v`
+                      //[mir]~| HELP make this binding mutable
+                      //[mir]~| SUGGESTION mut v
     v.clone();
     v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
            //[mir]~^ ERROR cannot assign twice to immutable variable `v`
index c67095d9ee7596ed332b61b3773b1aa7de4659de..d3ba6fc005ecc38ef331db7700510c3e501fbf71 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `foo` as mutable
   --> $DIR/span-covering-argument-1.rs:15:19
    |
 LL |             let $s = 0;
-   |                 -- consider changing this to `mut $s`
+   |                 -- help: make this binding mutable: `mut $s`
 LL |             *&mut $s = 0;
    |                   ^^ cannot borrow mutably
 ...
index 0df303eed779ad4af22819202008578cfd2cdfb4..8b8414b8f1b740617ef03d85f41aad9ae2084277 100644 (file)
@@ -5,7 +5,7 @@ LL |     let &mut x = foo;
    |              -
    |              |
    |              first assignment to `x`
-   |              consider changing this to `mut x`
+   |              help: make this binding mutable: `mut x`
 LL |     x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^^^^^^ cannot assign twice to immutable variable
 
index 0df303eed779ad4af22819202008578cfd2cdfb4..8b8414b8f1b740617ef03d85f41aad9ae2084277 100644 (file)
@@ -5,7 +5,7 @@ LL |     let &mut x = foo;
    |              -
    |              |
    |              first assignment to `x`
-   |              consider changing this to `mut x`
+   |              help: make this binding mutable: `mut x`
 LL |     x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
    |     ^^^^^^ cannot assign twice to immutable variable
 
index 39a1e93d61975545a3bb4766c8c2092c6ecdb79e..9501294a5ab0defe8a06bf92131e320925863f09 100644 (file)
@@ -1,18 +1,18 @@
 error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
-  --> $DIR/mut-suggestion.rs:21:5
+  --> $DIR/mut-suggestion.rs:22:5
    |
 LL | fn func(arg: S) {
    |         --- help: consider changing this to be mutable: `mut arg`
-LL |     //~^ consider changing this to `mut arg`
+...
 LL |     arg.mutate();
    |     ^^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable
-  --> $DIR/mut-suggestion.rs:29:5
+  --> $DIR/mut-suggestion.rs:31:5
    |
 LL |     let local = S;
    |         ----- help: consider changing this to be mutable: `mut local`
-LL |     //~^ consider changing this to `mut local`
+...
 LL |     local.mutate();
    |     ^^^^^ cannot borrow as mutable
 
index 0015c8e5c00a1212731754a71b73af892d25d0e2..af04927c713e9b974fb52d0fc97eaa43caa73f5c 100644 (file)
@@ -17,7 +17,8 @@ fn mutate(&mut self) {
 }
 
 fn func(arg: S) {
-    //~^ consider changing this to `mut arg`
+    //~^ HELP make this binding mutable
+    //~| SUGGESTION mut arg
     arg.mutate();
     //~^ ERROR cannot borrow immutable argument
     //~| cannot borrow mutably
@@ -25,7 +26,8 @@ fn func(arg: S) {
 
 fn main() {
     let local = S;
-    //~^ consider changing this to `mut local`
+    //~^ HELP make this binding mutable
+    //~| SUGGESTION mut local
     local.mutate();
     //~^ ERROR cannot borrow immutable local variable
     //~| cannot borrow mutably
index 4aa964903f59d641553aa87f0b9f44c447ee5751..b4917887630e6f5d7b66a6b9d762ce0b01ffa4e4 100644 (file)
@@ -1,18 +1,18 @@
 error[E0596]: cannot borrow immutable argument `arg` as mutable
-  --> $DIR/mut-suggestion.rs:21:5
+  --> $DIR/mut-suggestion.rs:22:5
    |
 LL | fn func(arg: S) {
-   |         --- consider changing this to `mut arg`
-LL |     //~^ consider changing this to `mut arg`
+   |         --- help: make this binding mutable: `mut arg`
+...
 LL |     arg.mutate();
    |     ^^^ cannot borrow mutably
 
 error[E0596]: cannot borrow immutable local variable `local` as mutable
-  --> $DIR/mut-suggestion.rs:29:5
+  --> $DIR/mut-suggestion.rs:31:5
    |
 LL |     let local = S;
-   |         ----- consider changing this to `mut local`
-LL |     //~^ consider changing this to `mut local`
+   |         ----- help: make this binding mutable: `mut local`
+...
 LL |     local.mutate();
    |     ^^^^^ cannot borrow mutably
 
index 0a4d3a0e96881b73ff0860ced9fb0ef854ab5060..fc12e22815eff449a0a603f1abcd40f1428b3a3d 100644 (file)
@@ -2,7 +2,7 @@ error[E0594]: cannot assign to field `nyan.how_hungry` of immutable binding
   --> $DIR/mutable-class-fields.rs:28:3
    |
 LL |   let nyan : cat = cat(52, 99);
-   |       ---- consider changing this to `mut nyan`
+   |       ---- help: make this binding mutable: `mut nyan`
 LL |   nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
    |   ^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
 
index 01c0603256c15123c86d19c92c0edf72a3ff88c1..d91ff6964237b2c65e5c116ec9b02b5463707b12 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:63:24
    |
 LL | fn deref_mut_field1(x: Own<Point>) {
-   |                     - consider changing this to `mut x`
+   |                     - help: make this binding mutable: `mut x`
 LL |     let __isize = &mut x.y; //~ ERROR cannot borrow
    |                        ^ cannot borrow mutably
 
@@ -28,7 +28,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5
    |
 LL | fn assign_field1<'a>(x: Own<Point>) {
-   |                      - consider changing this to `mut x`
+   |                      - help: make this binding mutable: `mut x`
 LL |     x.y = 3; //~ ERROR cannot borrow
    |     ^ cannot borrow mutably
 
@@ -54,7 +54,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5
    |
 LL | fn deref_mut_method1(x: Own<Point>) {
-   |                      - consider changing this to `mut x`
+   |                      - help: make this binding mutable: `mut x`
 LL |     x.set(0, 0); //~ ERROR cannot borrow
    |     ^ cannot borrow mutably
 
@@ -70,7 +70,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:139:6
    |
 LL | fn assign_method1<'a>(x: Own<Point>) {
-   |                       - consider changing this to `mut x`
+   |                       - help: make this binding mutable: `mut x`
 LL |     *x.y_mut() = 3; //~ ERROR cannot borrow
    |      ^ cannot borrow mutably
 
index 3a28ef36d05937ecd98420e8d1ca4e9f872d77e7..62be8e0f73e30a842d5a86ba9b967614708ccd72 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:39:25
    |
 LL | fn deref_mut1(x: Own<isize>) {
-   |               - consider changing this to `mut x`
+   |               - help: make this binding mutable: `mut x`
 LL |     let __isize = &mut *x; //~ ERROR cannot borrow
    |                         ^ cannot borrow mutably
 
@@ -18,7 +18,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable
   --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:59:6
    |
 LL | fn assign1<'a>(x: Own<isize>) {
-   |                - consider changing this to `mut x`
+   |                - help: make this binding mutable: `mut x`
 LL |     *x = 3; //~ ERROR cannot borrow
    |      ^ cannot borrow mutably
 
index 5bc07949a951ca3798baa467ab257a8d74b5f9f2..67ee911b381781a959777f2642ebc961a0a6b98f 100644 (file)
@@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
   --> $DIR/borrowck-object-mutability.rs:29:5
    |
 LL | fn owned_receiver(x: Box<Foo>) {
-   |                   - consider changing this to `mut x`
+   |                   - help: make this binding mutable: `mut x`
 LL |     x.borrowed();
 LL |     x.borrowed_mut(); //~ ERROR cannot borrow
    |     ^ cannot borrow as mutable
index 02fbb5f17eeedab695f76bb062446fc1cc5a4842..0ba48545c600be108de0cb626b10bfbfa0f63e0b 100644 (file)
@@ -2,7 +2,7 @@ error[E0595]: closure cannot assign to immutable local variable `x`
   --> $DIR/unboxed-closure-immutable-capture.rs:23:5
    |
 LL |     let x = 0;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |     || x = 1; //~ ERROR cannot assign
    |     ^^ cannot borrow mutably
@@ -11,7 +11,7 @@ error[E0595]: closure cannot assign to immutable local variable `x`
   --> $DIR/unboxed-closure-immutable-capture.rs:25:5
    |
 LL |     let x = 0;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |     || set(&mut x); //~ ERROR cannot assign
    |     ^^ cannot borrow mutably
@@ -20,7 +20,7 @@ error[E0595]: closure cannot assign to immutable local variable `x`
   --> $DIR/unboxed-closure-immutable-capture.rs:26:5
    |
 LL |     let x = 0;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |     || x = 1; //~ ERROR cannot assign
    |     ^^ cannot borrow mutably
@@ -29,7 +29,7 @@ error[E0595]: closure cannot assign to immutable local variable `x`
   --> $DIR/unboxed-closure-immutable-capture.rs:28:5
    |
 LL |     let x = 0;
-   |         - consider changing this to `mut x`
+   |         - help: make this binding mutable: `mut x`
 ...
 LL |     || set(&mut x); //~ ERROR cannot assign
    |     ^^ cannot borrow mutably
index bb2ffcd21b0969ed542c62a4bcb4bc3c25e52aaa..4303b4c2f21b729cd7bfa5434d0d99ef61adcae7 100644 (file)
@@ -2,7 +2,7 @@ error[E0595]: closure cannot assign to immutable local variable `tick1`
   --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:26:17
    |
 LL |     let tick1 = || {
-   |         ----- consider changing this to `mut tick1`
+   |         ----- help: make this binding mutable: `mut tick1`
 ...
 LL |     let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1`
    |                 ^^ cannot borrow mutably
@@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable local variable `tick2` as mutable
   --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5
    |
 LL |     let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1`
-   |         ----- consider changing this to `mut tick2`
+   |         ----- help: make this binding mutable: `mut tick2`
 ...
 LL |     tick2(); //~ ERROR cannot borrow
    |     ^^^^^ cannot borrow mutably
index 22e11b6977c03a22fd21b9065a701c38308021c9..1930a929da1a0c3818d75c97f1d473d0663be6ff 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable
   --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:17:5
    |
 LL |     let tick = || counter += 1;
-   |         ---- consider changing this to `mut tick`
+   |         ---- help: make this binding mutable: `mut tick`
 LL |     tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
    |     ^^^^ cannot borrow mutably
 
index f9fd6c21b706c284cc75a773997865d658ff5a94..9515fe502417a15eaf4f68621b8b067c9b69e333 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable
   --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:17:5
    |
 LL |     let tick = move || counter += 1;
-   |         ---- consider changing this to `mut tick`
+   |         ---- help: make this binding mutable: `mut tick`
 LL |     tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
    |     ^^^^ cannot borrow mutably
 
index 1164a864b6b46d6706e103268fd24e278049ae5c..c0a7f3f0709bd37c2ceebcd0eae1caadd9ec6d32 100644 (file)
@@ -2,7 +2,7 @@ error[E0595]: closure cannot assign to immutable local variable `n`
   --> $DIR/unboxed-closures-mutate-upvar.rs:24:27
    |
 LL |     let n = 0;
-   |         - consider changing this to `mut n`
+   |         - help: make this binding mutable: `mut n`
 LL |     let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
    |                           ^^ cannot borrow mutably
 
index 07e1779713909dfac2be07c5417034e4f289d9a2..d1e09521dd8ac21cb465ec70d206b2ef469a46fc 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable
   --> $DIR/writing-to-immutable-vec.rs:14:5
    |
 LL |     let v: Vec<isize> = vec![1, 2, 3];
-   |         - consider changing this to `mut v`
+   |         - help: make this binding mutable: `mut v`
 LL |     v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable
    |     ^ cannot borrow mutably