2023-05-01 01:34:01 -07:00
|
|
|
//@ edition:2021
|
2025-01-27 00:29:25 +01:00
|
|
|
// issue: https://github.com/rust-lang/rust/issues/111011
|
2023-05-01 01:34:01 -07:00
|
|
|
|
|
|
|
|
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() {
|
2025-01-27 00:29:25 +01:00
|
|
|
foo(async move || {});
|
2025-02-02 01:00:12 +00:00
|
|
|
//~^ ERROR expected `{async closure@dont-suggest-boxing-async-closure-body.rs:9:9}` to return `Box<_>`
|
2023-05-01 01:34:01 -07:00
|
|
|
bar(async move || {}); //~ ERROR mismatched types
|
|
|
|
|
}
|