rust/tests/ui/borrowck/borrowck-pat-reassign-no-binding.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
269 B
Rust
Raw Normal View History

// run-pass
pub fn main() {
2012-08-20 19:23:37 +00:00
let mut x = None;
2012-08-06 19:34:08 +00:00
match x {
2012-08-20 19:23:37 +00:00
None => {
// It is ok to reassign x here, because there is in
// fact no outstanding loan of x!
2015-01-25 21:05:03 +00:00
x = Some(0);
}
2012-08-20 19:23:37 +00:00
Some(_) => { }
}
2013-08-17 15:37:42 +00:00
assert_eq!(x, Some(0));
}