rust/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs

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

21 lines
320 B
Rust
Raw Permalink Normal View History

//@ compile-flags: -Zvalidate-mir --crate-type=lib -Copt-level=3
//@ edition: 2018
2024-09-15 19:18:41 +00:00
fn main() {}
fn needs_fn_mut<T>(mut x: impl FnMut() -> T) {
x();
}
fn hello(x: Ty) {
needs_fn_mut(async || {
//~^ ERROR cannot move out of `x`
2024-09-15 19:18:41 +00:00
x.hello();
});
}
struct Ty;
impl Ty {
fn hello(self) {}
}