Use more minimized test.
This commit is contained in:
parent
a7f609504c
commit
e2a50de5f4
2 changed files with 6 additions and 38 deletions
|
@ -1,12 +1,12 @@
|
||||||
// Test for issue #132429
|
// Test for issue #132429
|
||||||
//@compile-flags: -Zunstable-options --edition=2024
|
//@compile-flags: -Zunstable-options --edition=2024
|
||||||
|
//@check-pass
|
||||||
|
|
||||||
trait ThreeCellFragment {
|
use std::future::Future;
|
||||||
fn ext_cells<'a>(
|
|
||||||
&'a self,
|
trait Test {
|
||||||
) -> dyn core::future::Future<Output = impl IntoIterator<Item = u32>> + 'a {
|
fn foo<'a>(&'a self) -> Box<dyn Future<Output = impl IntoIterator<Item = u32>>> {
|
||||||
//~^ ERROR mismatched types
|
Box::new(async { [] })
|
||||||
//~| ERROR return type cannot have an unboxed trait object
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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`.
|
|
Loading…
Add table
Add a link
Reference in a new issue