diff --git a/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs b/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs index 5fdf8a8d1ee19..df6f196392340 100644 --- a/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs +++ b/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs @@ -1681,7 +1681,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { if decl.can_be_made_mutable() { err.span_suggestion( decl.source_info.span, - "make this binding mutable", + "consider making this binding mutable", format!("mut {}", name), Applicability::MachineApplicable, ); diff --git a/src/test/ui/assign-imm-local-twice.rs b/src/test/ui/assign-imm-local-twice.rs index c1c9bf62819af..b50f6ab5deb15 100644 --- a/src/test/ui/assign-imm-local-twice.rs +++ b/src/test/ui/assign-imm-local-twice.rs @@ -1,6 +1,6 @@ fn test() { let v: isize; - //~^ HELP make this binding mutable + //~^ HELP consider making this binding mutable //~| SUGGESTION mut v v = 1; //~ NOTE first assignment println!("v={}", v); diff --git a/src/test/ui/assign-imm-local-twice.stderr b/src/test/ui/assign-imm-local-twice.stderr index df0f4c4d80608..bba5d8dffe4bd 100644 --- a/src/test/ui/assign-imm-local-twice.stderr +++ b/src/test/ui/assign-imm-local-twice.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `v` --> $DIR/assign-imm-local-twice.rs:7:5 | LL | let v: isize; - | - help: make this binding mutable: `mut v` + | - help: consider making this binding mutable: `mut v` ... LL | v = 1; | ----- first assignment to `v` diff --git a/src/test/ui/async-await/issue-61452.stderr b/src/test/ui/async-await/issue-61452.stderr index 5eb4b54871737..f2dec87baf08b 100644 --- a/src/test/ui/async-await/issue-61452.stderr +++ b/src/test/ui/async-await/issue-61452.stderr @@ -13,7 +13,7 @@ LL | pub async fn g(x: usize) { | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/borrowck/borrowck-asm.stderr b/src/test/ui/borrowck/borrowck-asm.stderr index 3dccca784151e..74cf5a55b70ab 100644 --- a/src/test/ui/borrowck/borrowck-asm.stderr +++ b/src/test/ui/borrowck/borrowck-asm.stderr @@ -29,7 +29,7 @@ LL | let x = 3; | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | unsafe { LL | llvm_asm!("nop" : "=r"(x)); | ^ cannot assign twice to immutable variable @@ -41,7 +41,7 @@ LL | let x = 3; | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | unsafe { LL | llvm_asm!("nop" : "+r"(x)); | ^ cannot assign twice to immutable variable diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr index 5661ca52cbabc..dd22d7e2e2ed2 100644 --- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr +++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.stderr @@ -5,7 +5,7 @@ LL | x => { | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable @@ -16,7 +16,7 @@ LL | E::Foo(x) => { | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable @@ -27,7 +27,7 @@ LL | S { bar: x } => { | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable @@ -38,7 +38,7 @@ LL | (x,) => { | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable @@ -49,7 +49,7 @@ LL | [x,_,_] => { | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/borrowck/immutable-arg.stderr b/src/test/ui/borrowck/immutable-arg.stderr index 7255ca327e753..bddb0633a0b86 100644 --- a/src/test/ui/borrowck/immutable-arg.stderr +++ b/src/test/ui/borrowck/immutable-arg.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign to immutable argument `_x` --> $DIR/immutable-arg.rs:2:5 | LL | fn foo(_x: u32) { - | -- help: make this binding mutable: `mut _x` + | -- help: consider making this binding mutable: `mut _x` LL | _x = 4; | ^^^^^^ cannot assign to immutable argument diff --git a/src/test/ui/borrowck/issue-45199.rs b/src/test/ui/borrowck/issue-45199.rs index cbd45cbb61990..ded46e56e3451 100644 --- a/src/test/ui/borrowck/issue-45199.rs +++ b/src/test/ui/borrowck/issue-45199.rs @@ -1,6 +1,6 @@ fn test_drop_replace() { let b: Box; - //~^ HELP make this binding mutable + //~^ HELP consider making this binding mutable //~| SUGGESTION mut b b = Box::new(1); //~ NOTE first assignment b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b` @@ -9,13 +9,13 @@ fn test_drop_replace() { fn test_call() { let b = Box::new(1); //~ NOTE first assignment - //~| HELP make this binding mutable + //~| HELP consider making this binding mutable //~| SUGGESTION mut b b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b` //~| NOTE cannot assign twice to immutable } -fn test_args(b: Box) { //~ HELP make this binding mutable +fn test_args(b: Box) { //~ HELP consider making this binding mutable //~| SUGGESTION mut b b = Box::new(2); //~ ERROR cannot assign to immutable argument `b` //~| NOTE cannot assign to immutable argument diff --git a/src/test/ui/borrowck/issue-45199.stderr b/src/test/ui/borrowck/issue-45199.stderr index 83b634051bb00..47aa30908270d 100644 --- a/src/test/ui/borrowck/issue-45199.stderr +++ b/src/test/ui/borrowck/issue-45199.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `b` --> $DIR/issue-45199.rs:6:5 | LL | let b: Box; - | - help: make this binding mutable: `mut b` + | - help: consider making this binding mutable: `mut b` ... LL | b = Box::new(1); | - first assignment to `b` @@ -16,7 +16,7 @@ LL | let b = Box::new(1); | - | | | first assignment to `b` - | help: make this binding mutable: `mut b` + | help: consider making this binding mutable: `mut b` ... LL | b = Box::new(2); | ^ cannot assign twice to immutable variable @@ -25,7 +25,7 @@ error[E0384]: cannot assign to immutable argument `b` --> $DIR/issue-45199.rs:20:5 | LL | fn test_args(b: Box) { - | - help: make this binding mutable: `mut b` + | - help: consider making this binding mutable: `mut b` LL | LL | b = Box::new(2); | ^ cannot assign to immutable argument diff --git a/src/test/ui/command-line-diagnostics.stderr b/src/test/ui/command-line-diagnostics.stderr index b3f8d8a643fb5..6223ad880d695 100644 --- a/src/test/ui/command-line-diagnostics.stderr +++ b/src/test/ui/command-line-diagnostics.stderr @@ -5,7 +5,7 @@ LL | let x = 42; | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x = 43; | ^^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr index 5751c3194894e..bbd62902d9f44 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -12,7 +12,7 @@ error[E0384]: cannot assign to immutable argument `y` --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5 | LL | fn foo(mut x: Ref, y: &u32) { - | - help: make this binding mutable: `mut y` + | - help: consider making this binding mutable: `mut y` LL | y = x.b; | ^^^^^^^ cannot assign to immutable argument diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr index c646912d3b679..b47a47d631e5f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `x` --> $DIR/liveness-assign-imm-local-notes.rs:10:9 | LL | let x; - | - help: make this binding mutable: `mut x` + | - help: consider making this binding mutable: `mut x` ... LL | x = 2; | ----- first assignment to `x` @@ -13,7 +13,7 @@ error[E0384]: cannot assign twice to immutable variable `x` --> $DIR/liveness-assign-imm-local-notes.rs:21:13 | LL | let x; - | - help: make this binding mutable: `mut x` + | - help: consider making this binding mutable: `mut x` ... LL | x = 2; | ----- first assignment to `x` @@ -24,7 +24,7 @@ error[E0384]: cannot assign twice to immutable variable `x` --> $DIR/liveness-assign-imm-local-notes.rs:30:13 | LL | let x; - | - help: make this binding mutable: `mut x` + | - help: consider making this binding mutable: `mut x` ... LL | x = 1; | ^^^^^ cannot assign twice to immutable variable @@ -33,7 +33,7 @@ error[E0384]: cannot assign twice to immutable variable `x` --> $DIR/liveness-assign-imm-local-notes.rs:32:13 | LL | let x; - | - help: make this binding mutable: `mut x` + | - help: consider making this binding mutable: `mut x` ... LL | x = 1; | ----- first assignment to `x` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs index c9e1851b9a980..08911c5bde781 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs @@ -1,6 +1,6 @@ fn test() { let v: isize; - //~^ HELP make this binding mutable + //~^ HELP consider making this binding mutable //~| SUGGESTION mut v loop { v = 1; //~ ERROR cannot assign twice to immutable variable `v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr index 69dff734ee4be..66cdce7dacf83 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `v` --> $DIR/liveness-assign-imm-local-in-loop.rs:6:9 | LL | let v: isize; - | - help: make this binding mutable: `mut v` + | - help: consider making this binding mutable: `mut v` ... LL | v = 1; | ^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs index f24f7d2bcfc52..1752d969086e8 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs @@ -1,6 +1,6 @@ fn test() { let v: isize; - //~^ HELP make this binding mutable + //~^ HELP consider making this binding mutable //~| SUGGESTION mut v v = 2; //~ NOTE first assignment v += 1; //~ ERROR cannot assign twice to immutable variable `v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr index 182958dd49244..5db9539cbf1e5 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `v` --> $DIR/liveness-assign-imm-local-in-op-eq.rs:6:5 | LL | let v: isize; - | - help: make this binding mutable: `mut v` + | - help: consider making this binding mutable: `mut v` ... LL | v = 2; | ----- first assignment to `v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs index 8963e32717e22..c9b16e43910e8 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs @@ -1,6 +1,6 @@ fn test() { let b = Box::new(1); //~ NOTE first assignment - //~| HELP make this binding mutable + //~| HELP consider making this binding mutable //~| SUGGESTION mut b drop(b); b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr index 7c4af624b2735..bb7e7e27a4ca0 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.stderr @@ -5,7 +5,7 @@ LL | let b = Box::new(1); | - | | | first assignment to `b` - | help: make this binding mutable: `mut b` + | help: consider making this binding mutable: `mut b` ... LL | b = Box::new(2); | ^ cannot assign twice to immutable variable diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs index 4ab222af8d088..4bb2db27a1652 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs @@ -1,6 +1,6 @@ fn test() { let v: isize = 1; //~ NOTE first assignment - //~| HELP make this binding mutable + //~| HELP consider making this binding mutable //~| SUGGESTION mut v v.clone(); v = 2; //~ ERROR cannot assign twice to immutable variable `v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr index 6f5d5574877c9..80458a70a0107 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.stderr @@ -5,7 +5,7 @@ LL | let v: isize = 1; | - | | | first assignment to `v` - | help: make this binding mutable: `mut v` + | help: consider making this binding mutable: `mut v` ... LL | v = 2; | ^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr b/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr index 9b0aa6be1e91e..3e5893f68b6c1 100644 --- a/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr +++ b/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr @@ -2,7 +2,7 @@ error[E0384]: cannot assign twice to immutable variable `x` --> $DIR/llvm-asm-out-assign-imm.rs:25:39 | LL | let x: isize; - | - help: make this binding mutable: `mut x` + | - help: consider making this binding mutable: `mut x` LL | x = 1; | ----- first assignment to `x` ... diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.stderr index eaa33453a7507..6583546aa5c1f 100644 --- a/src/test/ui/mut/mut-pattern-internal-mutability.stderr +++ b/src/test/ui/mut/mut-pattern-internal-mutability.stderr @@ -5,7 +5,7 @@ LL | let &mut x = foo; | - | | | first assignment to `x` - | help: make this binding mutable: `mut x` + | help: consider making this binding mutable: `mut x` LL | x += 1; | ^^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr index 285c203f382df..d0726f05cc3be 100644 --- a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr +++ b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr @@ -16,7 +16,7 @@ LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; | --- | | | first assignment to `_x1` - | help: make this binding mutable: `mut _x1` + | help: consider making this binding mutable: `mut _x1` LL | _x1 = U; | ^^^^^^^ cannot assign twice to immutable variable @@ -74,7 +74,7 @@ LL | let (ref _x0, _x1, ref _x2, ..) = tup; | --- | | | first assignment to `_x1` - | help: make this binding mutable: `mut _x1` + | help: consider making this binding mutable: `mut _x1` LL | _x1 = U; | ^^^^^^^ cannot assign twice to immutable variable