rust/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.rs
Esteban Küber 9ebbba4ad9 Shorten error message for callable with wrong return type
```
error: expected `{closure@...}` to return `Ret`, but it returns `Other`
```
instead of
```
error: expected `{closure@...}` to be a closure that returns `Ret`, but it returns `Other`
```
2025-02-02 01:00:33 +00:00

13 lines
431 B
Rust

//@ edition:2021
// issue: https://github.com/rust-lang/rust/issues/111011
fn foo<X>(x: impl FnOnce() -> Box<X>) {}
// just to make sure async closures can still be suggested for boxing.
fn bar<X>(x: Box<dyn FnOnce() -> X>) {}
fn main() {
foo(async move || {});
//~^ ERROR expected `{async closure@dont-suggest-boxing-async-closure-body.rs:9:9}` to return `Box<_>`
bar(async move || {}); //~ ERROR mismatched types
}