about summary refs log tree commit diff
path: root/tests/ui/reborrow/custom_mut.stderr
blob: 3b3f47b62d6fa44325dba719d24cd94940d2e723 (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
error[E0382]: use of moved value: `a`
  --> $DIR/custom_mut.rs:12:20
   |
LL |     let a = CustomMut(&mut ());
   |         - move occurs because `a` has type `CustomMut<'_, ()>`, which does not implement the `Copy` trait
LL |     let _ = method(a);
   |                    - value moved here
LL |     let _ = method(a);
   |                    ^ value used here after move
   |
note: consider changing this parameter type in function `method` to borrow instead if owning the value isn't necessary
  --> $DIR/custom_mut.rs:7:14
   |
LL | fn method(a: CustomMut<'_, ()>) {}
   |    ------    ^^^^^^^^^^^^^^^^^ this parameter takes ownership of the value
   |    |
   |    in this function
note: if `CustomMut<'_, ()>` implemented `Clone`, you could clone the value
  --> $DIR/custom_mut.rs:4:1
   |
LL | struct CustomMut<'a, T>(&'a mut T);
   | ^^^^^^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |     let _ = method(a);
   |                    - you could clone this value

error: aborting due to 1 previous error

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