]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr
normalize use of backticks/lowercase in compiler messages for librustc_mir
[rust.git] / src / test / ui / borrowck / borrowck-mutate-in-guard.nll.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 error[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 error[E0510]: cannot mutably borrow `x` in match guard
30   --> $DIR/borrowck-mutate-in-guard.rs:15:33
31    |
32 LL |     match x {
33    |           - value is immutable in match guard
34 ...
35 LL |         Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
36    |                                 ^^^^^^ cannot mutably borrow
37
38 error: aborting due to 5 previous errors
39
40 Some errors have detailed explanations: E0301, E0302, E0510.
41 For more information about an error, try `rustc --explain E0301`.