mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 13:43:04 +00:00
Rename Gen
to Coro
in tests
This commit is contained in:
parent
2d91c76d5d
commit
82ffd58bfb
@ -10,18 +10,18 @@
|
||||
use std::ops::Coroutine;
|
||||
|
||||
pub trait CoroutineProviderAlt: Sized {
|
||||
type Gen: Coroutine<(), Return = (), Yield = ()>;
|
||||
type Coro: Coroutine<(), Return = (), Yield = ()>;
|
||||
|
||||
fn start(ctx: Context<Self>) -> Self::Gen;
|
||||
fn start(ctx: Context<Self>) -> Self::Coro;
|
||||
}
|
||||
|
||||
pub struct Context<G: 'static + CoroutineProviderAlt> {
|
||||
pub link: Box<G::Gen>,
|
||||
pub link: Box<G::Coro>,
|
||||
}
|
||||
|
||||
impl CoroutineProviderAlt for () {
|
||||
type Gen = impl Coroutine<(), Return = (), Yield = ()>;
|
||||
fn start(ctx: Context<Self>) -> Self::Gen {
|
||||
type Coro = impl Coroutine<(), Return = (), Yield = ()>;
|
||||
fn start(ctx: Context<Self>) -> Self::Coro {
|
||||
move || {
|
||||
match ctx {
|
||||
_ => (),
|
||||
|
@ -6,9 +6,9 @@
|
||||
mod gen {
|
||||
use std::ops::Coroutine;
|
||||
|
||||
pub type GenOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
|
||||
pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
|
||||
|
||||
pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
|
||||
pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> {
|
||||
move || {
|
||||
yield yielding;
|
||||
|
||||
@ -17,6 +17,6 @@ mod gen {
|
||||
}
|
||||
}
|
||||
|
||||
const FOO: gen::GenOnce<usize, usize> = gen::const_coroutine(10, 100);
|
||||
const FOO: gen::CoroOnce<usize, usize> = gen::const_coroutine(10, 100);
|
||||
|
||||
fn main() {}
|
||||
|
@ -2,17 +2,17 @@
|
||||
use std::ops::Coroutine;
|
||||
|
||||
trait Runnable {
|
||||
type Gen: Coroutine<Yield = (), Return = ()>;
|
||||
type Coro: Coroutine<Yield = (), Return = ()>;
|
||||
|
||||
fn run(&mut self) -> Self::Gen;
|
||||
fn run(&mut self) -> Self::Coro;
|
||||
}
|
||||
|
||||
struct Implementor {}
|
||||
|
||||
impl Runnable for Implementor {
|
||||
type Gen = impl Coroutine<Yield = (), Return = ()>;
|
||||
type Coro = impl Coroutine<Yield = (), Return = ()>;
|
||||
|
||||
fn run(&mut self) -> Self::Gen {
|
||||
fn run(&mut self) -> Self::Coro {
|
||||
//~^ ERROR: type mismatch resolving
|
||||
move || {
|
||||
yield 1;
|
||||
|
Loading…
Reference in New Issue
Block a user