]> git.proxmox.com Git - rustc.git/blame - src/test/ui/typeck/assign-non-lval-mut-ref.stderr
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / typeck / assign-non-lval-mut-ref.stderr
CommitLineData
923072b8
FG
1error[E0070]: invalid left-hand side of assignment
2 --> $DIR/assign-non-lval-mut-ref.rs:5:27
3 |
4LL | x.last_mut().unwrap() = 2;
5 | --------------------- ^
6 | |
7 | cannot assign to this expression
8 |
9help: consider dereferencing here to assign to the mutably borrowed value
10 |
11LL | *x.last_mut().unwrap() = 2;
12 | +
13
14error[E0368]: binary assignment operation `+=` cannot be applied to type `&mut usize`
15 --> $DIR/assign-non-lval-mut-ref.rs:7:5
16 |
17LL | x.last_mut().unwrap() += 1;
18 | ---------------------^^^^^
19 | |
20 | cannot use `+=` on type `&mut usize`
21 |
f2b60f7d 22help: `+=` can be used on `usize` if you dereference the left-hand side
923072b8
FG
23 |
24LL | *x.last_mut().unwrap() += 1;
25 | +
26
27error[E0308]: mismatched types
28 --> $DIR/assign-non-lval-mut-ref.rs:11:9
29 |
30LL | let y = x.last_mut().unwrap();
31 | --------------------- expected due to this value
32LL | y = 2;
33 | ^ expected `&mut usize`, found integer
34 |
35help: consider dereferencing here to assign to the mutably borrowed value
36 |
37LL | *y = 2;
38 | +
39
40error[E0368]: binary assignment operation `+=` cannot be applied to type `&mut usize`
41 --> $DIR/assign-non-lval-mut-ref.rs:13:5
42 |
43LL | y += 1;
44 | -^^^^^
45 | |
46 | cannot use `+=` on type `&mut usize`
47 |
f2b60f7d 48help: `+=` can be used on `usize` if you dereference the left-hand side
923072b8
FG
49 |
50LL | *y += 1;
51 | +
52
53error: aborting due to 4 previous errors
54
55Some errors have detailed explanations: E0070, E0308, E0368.
56For more information about an error, try `rustc --explain E0070`.