We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d017285 commit 1a77ca3Copy full SHA for 1a77ca3
0000-pattern-guards-with-bind-by-move.md
@@ -103,6 +103,21 @@ fn foo(n: int) {
103
}
104
```
105
106
+This example would also be rejected, even though there is no use of the
107
+move-bound variable in the first arm's expression, since the move into the bound
108
+variable would be moving the same value a second time:
109
+
110
+```rust
111
+enum VecWrapper { A(Vec<int>) }
112
113
+fn foo(x: VecWrapper) -> uint {
114
+ match x {
115
+ A(v) if { drop(v); false } => 1,
116
+ A(v) => v.len()
117
+ }
118
+}
119
+```
120
121
There are issues with mutation of the bound values, but that is true without
122
the changes proposed by this RFC, e.g.
123
[Rust issue #14684](https://github.com/mozilla/rust/issues/14684). The general
0 commit comments