fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.4 KiB37 linesraw
1error[E0510]: cannot assign `x` in match guard
2  --> $DIR/borrowck-mutate-in-guard.rs:12:25
3   |
4LL |     match x {
5   |           - value is immutable in match guard
6LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
7   |                         ^^^^^^^^^^^^^^^^^^ cannot assign
8
9error[E0510]: cannot mutably borrow `x` in match guard
10  --> $DIR/borrowck-mutate-in-guard.rs:14:33
11   |
12LL |     match x {
13   |           - value is immutable in match guard
14...
15LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
16   |                                 ^^^^^^ cannot mutably borrow
17
18error[E0510]: cannot assign `x` in match guard
19  --> $DIR/borrowck-mutate-in-guard.rs:25:40
20   |
21LL |     match x {
22   |           - value is immutable in match guard
23LL |         Enum::A(_) if let Some(()) = { x = Enum::B(false); None } => 1,
24   |                                        ^^^^^^^^^^^^^^^^^^ cannot assign
25
26error[E0510]: cannot mutably borrow `x` in match guard
27  --> $DIR/borrowck-mutate-in-guard.rs:27:48
28   |
29LL |     match x {
30   |           - value is immutable in match guard
31...
32LL |         Enum::A(_) if let Some(()) = { let y = &mut x; *y = Enum::B(false); None } => 1,
33   |                                                ^^^^^^ cannot mutably borrow
34
35error: aborting due to 4 previous errors
36
37For more information about this error, try `rustc --explain E0510`.