diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index ce7206be4c3..61b8b8d9220 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -360,7 +360,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } else { err.span_suggestion( span, - "consider using a reference instead", + "consider borrowing here", format!("&{}", snippet), ); } diff --git a/src/test/ui/suggestions/dont-suggest-ref.rs b/src/test/ui/suggestions/dont-suggest-ref.rs index b7047b01af0..90e8f951712 100644 --- a/src/test/ui/suggestions/dont-suggest-ref.rs +++ b/src/test/ui/suggestions/dont-suggest-ref.rs @@ -110,26 +110,26 @@ pub fn main() { let X(_t) = vs_[0]; //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vs_[0] if let Either::One(_t) = vr[0] { } //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vr[0] while let Either::One(_t) = vr[0] { } //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vr[0] match vr[0] { //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vr[0] Either::One(_t) | Either::Two(_t) => (), } match vr[0] { //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vr[0] Either::One(_t) => (), Either::Two(ref _t) => (), @@ -138,26 +138,26 @@ pub fn main() { let X(_t) = vsm[0]; //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vsm[0] if let Either::One(_t) = vrm[0] { } //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vrm[0] while let Either::One(_t) = vrm[0] { } //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vrm[0] match vrm[0] { //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vrm[0] Either::One(_t) | Either::Two(_t) => (), } match vrm[0] { //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vrm[0] Either::One(_t) => (), Either::Two(ref _t) => (), @@ -165,7 +165,7 @@ pub fn main() { } match vrm[0] { //~^ ERROR cannot move - //~| HELP consider using a reference instead + //~| HELP consider borrowing here //~| SUGGESTION &vrm[0] Either::One(_t) => (), Either::Two(ref mut _t) => (), diff --git a/src/test/ui/suggestions/dont-suggest-ref.stderr b/src/test/ui/suggestions/dont-suggest-ref.stderr index f18b609a175..7616aa898a0 100644 --- a/src/test/ui/suggestions/dont-suggest-ref.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref.stderr @@ -191,7 +191,7 @@ LL | let X(_t) = vs_[0]; | -- ^^^^^^ | | | | | cannot move out of borrowed content - | | help: consider using a reference instead: `&vs_[0]` + | | help: consider borrowing here: `&vs_[0]` | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait @@ -207,7 +207,7 @@ LL | if let Either::One(_t) = vr[0] { } | -- ^^^^^ | | | | | cannot move out of borrowed content - | | help: consider using a reference instead: `&vr[0]` + | | help: consider borrowing here: `&vr[0]` | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait @@ -223,7 +223,7 @@ LL | while let Either::One(_t) = vr[0] { } | -- ^^^^^ | | | | | cannot move out of borrowed content - | | help: consider using a reference instead: `&vr[0]` + | | help: consider borrowing here: `&vr[0]` | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait @@ -239,7 +239,7 @@ LL | match vr[0] { | ^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&vr[0]` + | help: consider borrowing here: `&vr[0]` ... LL | Either::One(_t) | -- data moved here @@ -257,7 +257,7 @@ LL | match vr[0] { | ^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&vr[0]` + | help: consider borrowing here: `&vr[0]` ... LL | Either::One(_t) => (), | -- data moved here @@ -275,7 +275,7 @@ LL | let X(_t) = vsm[0]; | -- ^^^^^^ | | | | | cannot move out of borrowed content - | | help: consider using a reference instead: `&vsm[0]` + | | help: consider borrowing here: `&vsm[0]` | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait @@ -291,7 +291,7 @@ LL | if let Either::One(_t) = vrm[0] { } | -- ^^^^^^ | | | | | cannot move out of borrowed content - | | help: consider using a reference instead: `&vrm[0]` + | | help: consider borrowing here: `&vrm[0]` | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait @@ -307,7 +307,7 @@ LL | while let Either::One(_t) = vrm[0] { } | -- ^^^^^^ | | | | | cannot move out of borrowed content - | | help: consider using a reference instead: `&vrm[0]` + | | help: consider borrowing here: `&vrm[0]` | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait @@ -323,7 +323,7 @@ LL | match vrm[0] { | ^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&vrm[0]` + | help: consider borrowing here: `&vrm[0]` ... LL | Either::One(_t) | -- data moved here @@ -341,7 +341,7 @@ LL | match vrm[0] { | ^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&vrm[0]` + | help: consider borrowing here: `&vrm[0]` ... LL | Either::One(_t) => (), | -- data moved here @@ -359,7 +359,7 @@ LL | match vrm[0] { | ^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&vrm[0]` + | help: consider borrowing here: `&vrm[0]` ... LL | Either::One(_t) => (), | -- data moved here