]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-51117.rs
Merge commit 'a8385522ade6f67853edac730b5bf164ddb298fd' into simd-remove-autosplats
[rust.git] / src / test / ui / borrowck / issue-51117.rs
1 // Regression test for #51117 in borrowck interaction with match
2 // default bindings. The borrow of `*bar` created by `baz` was failing
3 // to register as a conflict with `bar.take()`.
4
5 fn main() {
6     let mut foo = Some("foo".to_string());
7     let bar = &mut foo;
8     match bar {
9         Some(baz) => {
10             bar.take(); //~ ERROR cannot borrow
11             drop(baz);
12         },
13         None => unreachable!(),
14     }
15 }