mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
Fix mutability_error::overloaded_index test
This commit is contained in:
parent
798990bf33
commit
f1f64e92d7
@ -589,17 +589,17 @@ fn f() {
|
||||
let y = &x[2];
|
||||
let x = Foo;
|
||||
let y = &mut x[2];
|
||||
//^^^^ 💡 error: cannot mutate immutable variable `x`
|
||||
//^💡 error: cannot mutate immutable variable `x`
|
||||
let mut x = &mut Foo;
|
||||
//^^^^^ 💡 weak: variable does not need to be mutable
|
||||
let y: &mut (i32, u8) = &mut x[2];
|
||||
let x = Foo;
|
||||
let ref mut y = x[7];
|
||||
//^^^^ 💡 error: cannot mutate immutable variable `x`
|
||||
//^ 💡 error: cannot mutate immutable variable `x`
|
||||
let (ref mut y, _) = x[3];
|
||||
//^^^^ 💡 error: cannot mutate immutable variable `x`
|
||||
//^ 💡 error: cannot mutate immutable variable `x`
|
||||
match x[10] {
|
||||
//^^^^^ 💡 error: cannot mutate immutable variable `x`
|
||||
//^ 💡 error: cannot mutate immutable variable `x`
|
||||
(ref y, _) => (),
|
||||
(_, ref mut y) => (),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user