]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-87456-point-to-closure.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-87456-point-to-closure.rs
1 // Regression test for #87456.
2
3 fn take_mut(_val: impl FnMut()) {}
4
5 fn main() {
6     let val = String::new();
7     //~^ NOTE: captured outer variable
8     take_mut(|| {
9     //~^ NOTE: captured by this `FnMut` closure
10         let _foo: String = val;
11         //~^ ERROR: cannot move out of `val`, a captured variable in an `FnMut` closure [E0507]
12         //~| NOTE: move occurs because
13     })
14 }