2023-10-19 16:06:43 +00:00
|
|
|
trait Coroutine {
|
2016-08-05 20:18:01 +00:00
|
|
|
fn create() -> u32;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Impl;
|
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
impl Coroutine for Impl {
|
2016-08-05 20:18:01 +00:00
|
|
|
fn create() -> u32 { 1 }
|
|
|
|
}
|
|
|
|
|
2021-01-15 13:33:51 +00:00
|
|
|
impl Impl {
|
|
|
|
fn new() -> Self {
|
|
|
|
Impl{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<u32> for Impl {
|
|
|
|
fn into(self) -> u32 { 1 }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(bar: u32) {}
|
|
|
|
|
2016-08-05 20:18:01 +00:00
|
|
|
struct AnotherImpl;
|
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
impl Coroutine for AnotherImpl {
|
2016-08-05 20:18:01 +00:00
|
|
|
fn create() -> u32 { 2 }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-10-19 16:06:43 +00:00
|
|
|
let cont: u32 = Coroutine::create(); //~ ERROR E0790
|
2016-08-05 20:18:01 +00:00
|
|
|
}
|
2021-01-15 13:33:51 +00:00
|
|
|
|
|
|
|
fn buzz() {
|
|
|
|
let foo_impl = Impl::new();
|
|
|
|
let bar = foo_impl.into() * 1u32; //~ ERROR E0283
|
|
|
|
foo(bar);
|
|
|
|
}
|