mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 21:55:31 +00:00

``` 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` ```
13 lines
431 B
Rust
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
|
|
}
|