mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 19:43:43 +00:00
15 lines
390 B
Rust
15 lines
390 B
Rust
// Regression test for #87456.
|
|
|
|
fn take_mut(_val: impl FnMut()) {}
|
|
|
|
fn main() {
|
|
let val = String::new();
|
|
//~^ NOTE: captured outer variable
|
|
take_mut(|| {
|
|
//~^ NOTE: captured by this `FnMut` closure
|
|
let _foo: String = val;
|
|
//~^ ERROR: cannot move out of `val`, a captured variable in an `FnMut` closure [E0507]
|
|
//~| NOTE: move occurs because
|
|
})
|
|
}
|