about summary refs log tree commit diff
path: root/tests/ui/variance/variance-issue-20533.stderr
blob: 21d8de6ae8815de9ba274c5628764519e30b826c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
error[E0505]: cannot move out of `a` because it is borrowed
  --> $DIR/variance-issue-20533.rs:35:14
   |
LL |         let a = AffineU32(1);
   |             - binding `a` declared here
LL |         let x = foo(&a);
   |                     -- borrow of `a` occurs here
LL |         drop(a);
   |              ^ move out of `a` occurs here
LL |         drop(x);
   |              - borrow later used here
   |
note: if `AffineU32` implemented `Clone`, you could clone the value
  --> $DIR/variance-issue-20533.rs:26:1
   |
LL | struct AffineU32(u32);
   | ^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |         let x = foo(&a);
   |                      - you could clone this value

error[E0505]: cannot move out of `a` because it is borrowed
  --> $DIR/variance-issue-20533.rs:41:14
   |
LL |         let a = AffineU32(1);
   |             - binding `a` declared here
LL |         let x = bar(&a);
   |                     -- borrow of `a` occurs here
LL |         drop(a);
   |              ^ move out of `a` occurs here
LL |         drop(x);
   |              - borrow later used here
   |
note: if `AffineU32` implemented `Clone`, you could clone the value
  --> $DIR/variance-issue-20533.rs:26:1
   |
LL | struct AffineU32(u32);
   | ^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |         let x = bar(&a);
   |                      - you could clone this value

error[E0505]: cannot move out of `a` because it is borrowed
  --> $DIR/variance-issue-20533.rs:47:14
   |
LL |         let a = AffineU32(1);
   |             - binding `a` declared here
LL |         let x = baz(&a);
   |                     -- borrow of `a` occurs here
LL |         drop(a);
   |              ^ move out of `a` occurs here
LL |         drop(x);
   |              - borrow later used here
   |
note: if `AffineU32` implemented `Clone`, you could clone the value
  --> $DIR/variance-issue-20533.rs:26:1
   |
LL | struct AffineU32(u32);
   | ^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |         let x = baz(&a);
   |                      - you could clone this value

error[E0505]: cannot move out of `a` because it is borrowed
  --> $DIR/variance-issue-20533.rs:53:14
   |
LL |         let a = AffineU32(1);
   |             - binding `a` declared here
LL |         let x = bat(&a);
   |                     -- borrow of `a` occurs here
LL |         drop(a);
   |              ^ move out of `a` occurs here
LL |         drop(x);
   |              - borrow later used here
   |
note: if `AffineU32` implemented `Clone`, you could clone the value
  --> $DIR/variance-issue-20533.rs:26:1
   |
LL | struct AffineU32(u32);
   | ^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |         let x = bat(&a);
   |                      - you could clone this value

error[E0505]: cannot move out of `a` because it is borrowed
  --> $DIR/variance-issue-20533.rs:59:14
   |
LL |         let a = ClonableAffineU32(1);
   |             - binding `a` declared here
LL |         let x = foo(&a);
   |                     -- borrow of `a` occurs here
LL |         drop(a);
   |              ^ move out of `a` occurs here
LL |         drop(x);
   |              - borrow later used here
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL |         let x = foo(&a.clone());
   |                       ++++++++

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0505`.