diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2024-11-01 18:00:36 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2024-11-01 18:13:26 +0000 |
| commit | e2a50de5f4cda9958f910ee86a05c46e81767a32 (patch) | |
| tree | 045c802da68ea8beb9ce68b9eb93622428596331 | |
| parent | a7f609504c92c9912b61025ae26a5404d3ee4311 (diff) | |
| download | rust-e2a50de5f4cda9958f910ee86a05c46e81767a32.tar.gz rust-e2a50de5f4cda9958f910ee86a05c46e81767a32.zip | |
Use more minimized test.
| -rw-r--r-- | tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs | 12 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.stderr | 32 |
2 files changed, 6 insertions, 38 deletions
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<Output = impl IntoIterator<Item = u32>> + '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<dyn Future<Output = impl IntoIterator<Item = u32>>> { + 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<Output = impl IntoIterator<Item = u32>> + 'a { - | ________________________________________________________________________________^ -LL | | -LL | | -LL | | } - | |_____^ expected `dyn Future`, found `()` - | - = note: expected trait object `(dyn Future<Output = _> + '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<Output = impl IntoIterator<Item = u32>> + '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<Output = impl IntoIterator<Item = u32>> + 'a { - | ~~~~ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` - | -LL | ) -> Box<dyn core::future::Future<Output = impl IntoIterator<Item = u32>> + '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`. |
