summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/borrowck/borrowck-mutate-in-guard.stderr')
-rw-r--r--src/test/ui/borrowck/borrowck-mutate-in-guard.stderr20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
new file mode 100644
index 000000000..6d05e9725
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
@@ -0,0 +1,20 @@
+error[E0510]: cannot assign `x` in match guard
+ --> $DIR/borrowck-mutate-in-guard.rs:10:25
+ |
+LL | match x {
+ | - value is immutable in match guard
+LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
+ | ^^^^^^^^^^^^^^^^^^ cannot assign
+
+error[E0510]: cannot mutably borrow `x` in match guard
+ --> $DIR/borrowck-mutate-in-guard.rs:12:33
+ |
+LL | match x {
+ | - value is immutable in match guard
+...
+LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+ | ^^^^^^ cannot mutably borrow
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0510`.