Use more minimized test.

This commit is contained in:
Camille GILLOT 2024-11-01 18:00:36 +00:00
parent a7f609504c
commit e2a50de5f4
2 changed files with 6 additions and 38 deletions

View File

@ -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 { [] })
}
}

View File

@ -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`.