]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
Add FAQ for NLL migration
[rust.git] / src / test / ui / borrowck / borrowck-mutate-in-guard.stderr
1 error[E0302]: cannot assign in a pattern guard
2   --> $DIR/borrowck-mutate-in-guard.rs:10:25
3    |
4 LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
5    |                         ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
6
7 error[E0301]: cannot mutably borrow in a pattern guard
8   --> $DIR/borrowck-mutate-in-guard.rs:15:38
9    |
10 LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
11    |                                      ^ borrowed mutably in pattern guard
12    |
13    = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable
14
15 error[E0302]: cannot assign in a pattern guard
16   --> $DIR/borrowck-mutate-in-guard.rs:15:41
17    |
18 LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
19    |                                         ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
20
21 warning[E0510]: cannot assign `x` in match guard
22   --> $DIR/borrowck-mutate-in-guard.rs:10:25
23    |
24 LL |     match x {
25    |           - value is immutable in match guard
26 LL |         Enum::A(_) if { x = Enum::B(false); false } => 1,
27    |                         ^^^^^^^^^^^^^^^^^^ cannot assign
28    |
29    = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
30    = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
31    = note: for more information, try `rustc --explain E0729`
32
33 warning[E0510]: cannot mutably borrow `x` in match guard
34   --> $DIR/borrowck-mutate-in-guard.rs:15:33
35    |
36 LL |     match x {
37    |           - value is immutable in match guard
38 ...
39 LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
40    |                                 ^^^^^^ cannot mutably borrow
41    |
42    = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
43    = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
44    = note: for more information, try `rustc --explain E0729`
45
46 error: aborting due to 3 previous errors
47
48 Some errors have detailed explanations: E0301, E0302, E0510.
49 For more information about an error, try `rustc --explain E0301`.