Diffstat (limited to 'src/protocol/visitor/value.rs')
| -rw-r--r-- | src/protocol/visitor/value.rs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/protocol/visitor/value.rs b/src/protocol/visitor/value.rs index f34cdcd..59bf907 100644 --- a/src/protocol/visitor/value.rs +++ b/src/protocol/visitor/value.rs @@ -2,7 +2,11 @@ //! //! In some sense, this is the most basic protocol. -use effectful::{bound::{Bool, IsSend, IsSync}, environment::{DynBind, EnvConfig, Environment, NativeForm}}; +use effectful::{ + bound::{Bool, IsSend, IsSync}, + effective::Effective, + environment::{DynBind, EnvConfig, Environment, NativeForm}, +}; use crate::{ any::TypeName, @@ -33,13 +37,14 @@ pub trait Value<'ctx, T: ?Sized + TypeName::MemberType<E>, E: Environment>: DynB value: TypeName::T<'a, 'ctx, T, E>, ) -> NativeForm<'a, VisitResult<TypeName::T<'a, 'ctx, T, E>>, E> where - TypeName::T<'a, 'ctx, T, E>: Send + Sync + Sized, + TypeName::T<'a, 'ctx, T, E>: Sized, 'ctx: 'a; } pub struct ValueProto<T: ?Sized + TypeName::MemberType<E>, E: Environment>(Marker<(*const T, E)>); -impl<'a, 'ctx, T: ?Sized, E> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()> for ValueProto<T, E> +impl<'a, 'ctx, T: ?Sized, E> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()> + for ValueProto<T, E> where E: Environment, T: TypeName::MemberType<E>, @@ -70,7 +75,8 @@ unsafe impl<'a, T: ?Sized + IsSync<F>, F: Bool> IsSync<F> for ValueKnown<'a, T> #[derive(Copy, Clone, Debug)] pub struct ValueKnownHrt<T: ?Sized>(Marker<T>); -impl<'a, 'ctx, E: EnvConfig, T> Meta::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()> for ValueKnownHrt<T> +impl<'a, 'ctx, E: EnvConfig, T> Meta::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()> + for ValueKnownHrt<T> where T: ?Sized + TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>, TypeName::T<'a, 'ctx, T, E>: IsSync<E::NeedSend>, @@ -78,7 +84,8 @@ where type T = ValueKnown<'a, TypeName::T<'a, 'ctx, T, E>>; } -impl<'a, 'ctx, E: EnvConfig, T: ?Sized> Meta::LowerTypeWithBound<'a, 'ctx, E, &'a &'ctx ()> for ValueKnown<'a, T> +impl<'a, 'ctx, E: EnvConfig, T: ?Sized> Meta::LowerTypeWithBound<'a, 'ctx, E, &'a &'ctx ()> + for ValueKnown<'a, T> where T: TypeName::LowerType<'a, 'ctx, E>, T: IsSync<E::NeedSend>, @@ -87,7 +94,7 @@ where } // This enrolls the Value protocol into the walker hint system. -impl<T: TypeName::MemberType<E>, E: Environment> HintMeta for ValueProto<T, E> +impl<T: TypeName::MemberType<E>, E: Environment> HintMeta for ValueProto<T, E> where for<'a, 'ctx> TypeName::T<'a, 'ctx, T, E>: IsSync<E::NeedSend>, { @@ -102,12 +109,15 @@ pub fn visit_value< 'ctx: 'visitor, 'visitor: 'e, 'e, - T: Send + Sync + TypeName::LowerType<'e, 'ctx, E>, + T: TypeName::LowerType<'e, 'ctx, E>, E: Environment, >( visitor: DynVisitor<'visitor, 'ctx, E>, value: T, -) -> NativeForm<'e, VisitResult<T>, E> { +) -> NativeForm<'e, VisitResult<T>, E> +where + TypeName::HigherRanked<'e, 'ctx, T, E>: TypeName::MemberType<E>, +{ if let Some(object) = visitor .0 .upcast_mut::<ValueProto<TypeName::HigherRanked<'e, 'ctx, T, E>, E>>() |