]> git.proxmox.com Git - rustc.git/blob - src/test/ui/did_you_mean/issue-39544.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / did_you_mean / issue-39544.rs
1 pub enum X {
2 Y
3 }
4
5 pub struct Z {
6 x: X
7 }
8
9 fn main() {
10 let z = Z { x: X::Y };
11 let _ = &mut z.x; //~ ERROR cannot borrow
12 }
13
14 impl Z {
15 fn foo<'z>(&'z self) {
16 let _ = &mut self.x; //~ ERROR cannot borrow
17 }
18
19 fn foo1(&self, other: &Z) {
20 let _ = &mut self.x; //~ ERROR cannot borrow
21 let _ = &mut other.x; //~ ERROR cannot borrow
22 }
23
24 fn foo2<'a>(&'a self, other: &Z) {
25 let _ = &mut self.x; //~ ERROR cannot borrow
26 let _ = &mut other.x; //~ ERROR cannot borrow
27 }
28
29 fn foo3<'a>(self: &'a Self, other: &Z) {
30 let _ = &mut self.x; //~ ERROR cannot borrow
31 let _ = &mut other.x; //~ ERROR cannot borrow
32 }
33
34 fn foo4(other: &Z) {
35 let _ = &mut other.x; //~ ERROR cannot borrow
36 }
37
38 }
39
40 pub fn with_arg(z: Z, w: &Z) {
41 let _ = &mut z.x; //~ ERROR cannot borrow
42 let _ = &mut w.x; //~ ERROR cannot borrow
43 }
44
45 pub fn with_tuple() {
46 let mut y = 0;
47 let x = (&y,);
48 *x.0 = 1;
49 //~^ ERROR cannot assign to `*x.0`, which is behind a `&` reference
50 }