diff --git a/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs b/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs index 9d1bb22434c..83466535e13 100644 --- a/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs +++ b/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs @@ -1,12 +1,12 @@ // Test for issue #132429 //@compile-flags: -Zunstable-options --edition=2024 +//@check-pass -trait ThreeCellFragment { - fn ext_cells<'a>( - &'a self, - ) -> dyn core::future::Future> + 'a { - //~^ ERROR mismatched types - //~| ERROR return type cannot have an unboxed trait object +use std::future::Future; + +trait Test { + fn foo<'a>(&'a self) -> Box>> { + Box::new(async { [] }) } } diff --git a/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.stderr b/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.stderr deleted file mode 100644 index f771b802af9..00000000000 --- a/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/late-bound-in-object-assocty.rs:7:80 - | -LL | ) -> dyn core::future::Future> + 'a { - | ________________________________________________________________________________^ -LL | | -LL | | -LL | | } - | |_____^ expected `dyn Future`, found `()` - | - = note: expected trait object `(dyn Future + 'a)` - found unit type `()` - -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/late-bound-in-object-assocty.rs:7:10 - | -LL | ) -> dyn core::future::Future> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -help: consider returning an `impl Trait` instead of a `dyn Trait` - | -LL | ) -> impl core::future::Future> + 'a { - | ~~~~ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` - | -LL | ) -> Box> + 'a> { - | ++++ + - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0308, E0746. -For more information about an error, try `rustc --explain E0308`.