summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/borrowck-pat-reassign-no-binding.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/borrowck/borrowck-pat-reassign-no-binding.rs')
-rw-r--r--src/test/ui/borrowck/borrowck-pat-reassign-no-binding.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-no-binding.rs b/src/test/ui/borrowck/borrowck-pat-reassign-no-binding.rs
new file mode 100644
index 000000000..1362fd8ce
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-pat-reassign-no-binding.rs
@@ -0,0 +1,14 @@
+// run-pass
+
+pub fn main() {
+ let mut x = None;
+ match x {
+ None => {
+ // It is ok to reassign x here, because there is in
+ // fact no outstanding loan of x!
+ x = Some(0);
+ }
+ Some(_) => { }
+ }
+ assert_eq!(x, Some(0));
+}