Description
I have a trait such as this:
#[trait_variant::make(Test: Send)]
trait LocalTest {
async fn foo() -> i32 { 0 }
}
but if fails with an error:
|
3 | #[trait_variant::make(Test: Send)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `{integer}` is not a future
|
It looks like the body of the default impl is translated to the Test
trait, unchanged.
If I instead I try:
async fn foo() -> i32 { std::future::ready(0) }
Then it looks like the Test
works, but LocalTest
fails with a somewhat opposite error:
5 | async fn foo() -> i32 { std::future::ready(0) }
| ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `Ready<{integer}>`
I'm not sure if this is a limitation of this crate, if so I think it should be documented somewhere; or if it is an oversight in the implementation. Or maybe I'm missing something?
Then, just to see what would happen, I tried:
async fn foo() -> i32 { async move { 0 } }
And I got an ICE!
5 | async fn foo() -> i32 { async move { 0 } }
| ^^^^^^^^^^^^^^^^ expected `i32`, found `async` block
|
= note: expected type `i32`
found `async` block `{async block@src/main.rs:5:29: 5:45}`
error: internal compiler error: compiler/rustc_mir_build/src/build/mod.rs:655:72: impossible case reached
...
Metadata
Metadata
Assignees
Labels
No labels