Make move errors more consistent with typeck errors
This commit is contained in:
parent
701c74e067
commit
10aaba8dbe
@ -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),
|
||||
);
|
||||
}
|
||||
|
@ -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) => (),
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user