summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr
blob: 394629c000136b62d02e4aa4414b0a8a6a1de371 (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
error[E0505]: cannot move out of `value` because it is borrowed
  --> $DIR/if-let-guards-errors.rs:16:13
   |
LL |     let f = |x: &E| {
   |             ------- borrow of `value` occurs here
LL |         match &x {
LL |             E::Number(_) if let E::Number(ref mut n) = *value => { }
   |                                                        ------ borrow occurs due to use in closure
...
LL |     let x = value;
   |             ^^^^^ move out of `value` occurs here
LL |
LL |     drop(f);
   |          - borrow later used here

error[E0382]: use of moved value: `value`
  --> $DIR/if-let-guards-errors.rs:28:13
   |
LL | fn if_let_move(value: Box<E>) {
   |                ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait
LL |     let f = |x: &E| {
   |             ------- value moved into closure here
LL |         match &x {
LL |             E::Number(_) if let E::String(s) = *value => { }
   |                                                ------ variable moved due to use in closure
...
LL |     let x = value;
   |             ^^^^^ value used here after move

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0382, E0505.
For more information about an error, try `rustc --explain E0382`.