mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Fix mutability_error::overloaded_index test
This commit is contained in:
parent
798990bf33
commit
f1f64e92d7
1 changed files with 4 additions and 4 deletions
|
@ -589,17 +589,17 @@ fn f() {
|
||||||
let y = &x[2];
|
let y = &x[2];
|
||||||
let x = Foo;
|
let x = Foo;
|
||||||
let y = &mut x[2];
|
let y = &mut x[2];
|
||||||
//^^^^ 💡 error: cannot mutate immutable variable `x`
|
//^💡 error: cannot mutate immutable variable `x`
|
||||||
let mut x = &mut Foo;
|
let mut x = &mut Foo;
|
||||||
//^^^^^ 💡 weak: variable does not need to be mutable
|
//^^^^^ 💡 weak: variable does not need to be mutable
|
||||||
let y: &mut (i32, u8) = &mut x[2];
|
let y: &mut (i32, u8) = &mut x[2];
|
||||||
let x = Foo;
|
let x = Foo;
|
||||||
let ref mut y = x[7];
|
let ref mut y = x[7];
|
||||||
//^^^^ 💡 error: cannot mutate immutable variable `x`
|
//^ 💡 error: cannot mutate immutable variable `x`
|
||||||
let (ref mut y, _) = x[3];
|
let (ref mut y, _) = x[3];
|
||||||
//^^^^ 💡 error: cannot mutate immutable variable `x`
|
//^ 💡 error: cannot mutate immutable variable `x`
|
||||||
match x[10] {
|
match x[10] {
|
||||||
//^^^^^ 💡 error: cannot mutate immutable variable `x`
|
//^ 💡 error: cannot mutate immutable variable `x`
|
||||||
(ref y, _) => (),
|
(ref y, _) => (),
|
||||||
(_, ref mut y) => (),
|
(_, ref mut y) => (),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue