rust/tests/ui/async-await/async-closures/not-fn.rs

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

14 lines
313 B
Rust
Raw Permalink Normal View History

2024-02-14 23:52:57 +00:00
//@ edition:2021
// FIXME(async_closures): This needs a better error message!
fn main() {
fn needs_fn<T>(_: impl FnMut() -> T) {}
let mut x = 1;
needs_fn(async || {
//~^ ERROR async closure does not implement `FnMut` because it captures state from its environment
2024-02-14 23:52:57 +00:00
x += 1;
});
}