forked from lavina/lavina
1
0
Fork 0

Update rust toolchain

This commit is contained in:
Nikita Vilunov 2023-11-20 17:19:12 +01:00
parent ff806cc3d9
commit 4dbc68adfe
5 changed files with 11 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/target
/db.sqlite
.idea/
.DS_Store

View File

@ -1,4 +1,4 @@
#![feature(generators, generator_trait, type_alias_impl_trait, impl_trait_in_assoc_type)]
#![feature(coroutines, coroutine_trait, type_alias_impl_trait, impl_trait_in_assoc_type)]
mod proto;

View File

@ -1,6 +1,6 @@
#![feature(
generators,
generator_trait,
coroutines,
coroutine_trait,
type_alias_impl_trait,
impl_trait_in_assoc_type
)]

View File

@ -1,4 +1,4 @@
use std::ops::Generator;
use std::ops::Coroutine;
use std::pin::Pin;
use quick_xml::NsReader;
@ -37,7 +37,7 @@ pub trait Parser: Sized {
impl<T, Out> Parser for T
where
T: Generator<(ResolveResult<'static>, &'static Event<'static>), Yield = (), Return = Out>
T: Coroutine<(ResolveResult<'static>, &'static Event<'static>), Yield = (), Return = Out>
+ Unpin,
{
type Output = Out;
@ -48,13 +48,13 @@ where
event: &Event<'a>,
) -> Continuation<Self, Self::Output> {
let s = Pin::new(&mut self);
// this is a very rude workaround fixing the fact that rust generators
// 1. don't support higher-kinded lifetimes (i.e. no `impl for <'a> Generator<Event<'a>>)
// this is a very rude workaround fixing the fact that rust coroutines
// 1. don't support higher-kinded lifetimes (i.e. no `impl for <'a> Coroutine<Event<'a>>)
// 2. don't track borrows across yield points and lack thereof
// implementors of Parser should manually check that inputs are not used across yields
match s.resume(unsafe { std::mem::transmute((namespace, event)) }) {
std::ops::GeneratorState::Yielded(()) => Continuation::Continue(self),
std::ops::GeneratorState::Complete(res) => Continuation::Final(res),
std::ops::CoroutineState::Yielded(()) => Continuation::Continue(self),
std::ops::CoroutineState::Complete(res) => Continuation::Final(res),
}
}
}

View File

@ -1 +1 @@
nightly-2023-10-06
nightly-2023-11-20