tweak spans for ref mut suggestion
This commit is contained in:
parent
336a6569f5
commit
87a1b3840e
5 changed files with 18 additions and 19 deletions
|
|
@ -7,7 +7,7 @@ LL | *my_ref = 0;
|
|||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | let ref mut my_ref @ _ = 0;
|
||||
| ~~~~~~~~~~~~~~
|
||||
| +++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ LL | *_x0 = U;
|
|||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | let (ref mut _x0, _x1, ref _x2, ..) = tup;
|
||||
| ~~~~~~~~~~~
|
||||
| +++
|
||||
|
||||
error[E0594]: cannot assign to `*_x2`, which is behind a `&` reference
|
||||
--> $DIR/borrowck-move-ref-pattern.rs:27:5
|
||||
|
|
@ -123,7 +123,7 @@ LL | *_x2 = U;
|
|||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | let (ref _x0, _x1, ref mut _x2, ..) = tup;
|
||||
| ~~~~~~~~~~~
|
||||
| +++
|
||||
|
||||
error[E0382]: use of moved value: `tup.1`
|
||||
--> $DIR/borrowck-move-ref-pattern.rs:28:10
|
||||
|
|
|
|||
|
|
@ -12,12 +12,10 @@ impl X {
|
|||
fn main() {
|
||||
let ref foo = 16;
|
||||
//~^ HELP
|
||||
//~| SUGGESTION ref mut foo
|
||||
*foo = 32;
|
||||
//~^ ERROR
|
||||
if let Some(ref bar) = Some(16) {
|
||||
//~^ HELP
|
||||
//~| SUGGESTION ref mut bar
|
||||
*bar = 32;
|
||||
//~^ ERROR
|
||||
}
|
||||
|
|
@ -25,6 +23,5 @@ fn main() {
|
|||
ref quo => { *quo = 32; },
|
||||
//~^ ERROR
|
||||
//~| HELP
|
||||
//~| SUGGESTION ref mut quo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | fn zap(&mut self) {
|
|||
| ~~~~~~~~~
|
||||
|
||||
error[E0594]: cannot assign to `*foo`, which is behind a `&` reference
|
||||
--> $DIR/suggest-ref-mut.rs:16:5
|
||||
--> $DIR/suggest-ref-mut.rs:15:5
|
||||
|
|
||||
LL | *foo = 32;
|
||||
| ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written
|
||||
|
|
@ -18,10 +18,10 @@ LL | *foo = 32;
|
|||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | let ref mut foo = 16;
|
||||
| ~~~~~~~~~~~
|
||||
| +++
|
||||
|
||||
error[E0594]: cannot assign to `*bar`, which is behind a `&` reference
|
||||
--> $DIR/suggest-ref-mut.rs:21:9
|
||||
--> $DIR/suggest-ref-mut.rs:19:9
|
||||
|
|
||||
LL | *bar = 32;
|
||||
| ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written
|
||||
|
|
@ -29,10 +29,10 @@ LL | *bar = 32;
|
|||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | if let Some(ref mut bar) = Some(16) {
|
||||
| ~~~~~~~~~~~
|
||||
| +++
|
||||
|
||||
error[E0594]: cannot assign to `*quo`, which is behind a `&` reference
|
||||
--> $DIR/suggest-ref-mut.rs:25:22
|
||||
--> $DIR/suggest-ref-mut.rs:23:22
|
||||
|
|
||||
LL | ref quo => { *quo = 32; },
|
||||
| ^^^^^^^^^ `quo` is a `&` reference, so the data it refers to cannot be written
|
||||
|
|
@ -40,7 +40,7 @@ LL | ref quo => { *quo = 32; },
|
|||
help: consider changing this to be a mutable reference
|
||||
|
|
||||
LL | ref mut quo => { *quo = 32; },
|
||||
| ~~~~~~~~~~~
|
||||
| +++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue