diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/nll/issue-27282-mutation-in-guard.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/nll/issue-27282-mutation-in-guard.rs b/src/test/ui/nll/issue-27282-mutation-in-guard.rs new file mode 100644 index 000000000..395c7d214 --- /dev/null +++ b/src/test/ui/nll/issue-27282-mutation-in-guard.rs @@ -0,0 +1,13 @@ +fn main() { + match Some(&4) { + None => {}, + ref mut foo + if { + (|| { let bar = foo; bar.take() })(); + //~^ ERROR cannot move out of `foo` in pattern guard + false + } => {}, + Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."), + _ => println!("Here is some supposedly unreachable code."), + } +} |