Diffstat (limited to 'tests/common/builder.rs')
-rw-r--r--tests/common/builder.rs50
1 files changed, 24 insertions, 26 deletions
diff --git a/tests/common/builder.rs b/tests/common/builder.rs
index 258940f..1a20abb 100644
--- a/tests/common/builder.rs
+++ b/tests/common/builder.rs
@@ -1,10 +1,9 @@
use core::fmt::{Debug, Display};
use effectful::{
- DynBind,
bound::{Bool, Dynamic, IsSend, IsSync},
- effective::{Effective, Canonical},
- environment::{Environment},
- forward_send_sync, SendSync,
+ effective::{Canonical, Effective},
+ environment::Environment,
+ forward_send_sync, DynBind, SendSync,
};
use mockall::mock;
use treaty::{
@@ -37,7 +36,7 @@ mock! {
// pub fn traits(&self, id: WithLtTypeId<'_, '_>) -> &Option<Box<DynamicShim<dyn for<'ctx> AnyTrait<'ctx, E>>>>;
// pub fn traits_mut(&mut self, id: WithLtTypeId<'_, '_>) -> &mut Option<Box<DynamicShim<dyn for<'ctx> AnyTrait<'ctx, E>>>>;
- pub fn traits_mut(&mut self) -> &mut Box<dyn for<'a, 'ctx> FnMut(WithLtTypeId<'a, 'ctx>) -> Option<MutAnyUnsized<'a, 'a, 'ctx>> + Send>;
+ pub fn traits_mut(&mut self) -> &mut Box<dyn for<'r, 'src> FnMut(WithLtTypeId<'src>, &'r ()) -> Option<MutAnyUnsized<'r, 'src>> + Send>;
}
}
@@ -79,8 +78,13 @@ impl<Seed: 'static, Value: 'static, Error: 'static, E: Environment>
}
}
-impl<'lt, 'ctx, Seed: DynBind<E>, Value: Send, Error: DynBind<E> + Display + Debug, E: Environment + Send>
- Builder<'lt, 'ctx, E> for MockBuilder<Seed, Value, Error, E>
+impl<
+ 'ctx,
+ Seed: DynBind<E>,
+ Value: Send,
+ Error: DynBind<E> + Display + Debug,
+ E: Environment + Send,
+ > Builder<'ctx, E> for MockBuilder<Seed, Value, Error, E>
where
Dynamic<Value>: DynBind<E>,
{
@@ -99,43 +103,37 @@ where
}
}
-impl<'lt, 'ctx, Seed, Value: Send, Error: Display + Debug, E: Environment + Send> AsVisitor<'lt, 'ctx, E>
+impl<'ctx, Seed, Value: Send, Error: Display + Debug, E: Environment + Send> AsVisitor<'ctx, E>
for MockBuilder<Seed, Value, Error, E>
where
Seed: DynBind<E>,
Error: DynBind<E>,
Dynamic<Value>: DynBind<E>,
{
- fn as_visitor(&mut self) -> DynVisitor<'_, 'lt, 'ctx, E> {
- DynVisitor(self)
+ fn as_visitor(&mut self) -> DynVisitor<'_, 'ctx, E> {
+ DynVisitor::new(self)
}
}
-impl<'lt, 'ctx: 'lt, Seed, Value, Error, E: Environment> AnyTrait<'lt, 'ctx> for MockBuilder<Seed, Value, Error, E>
+impl<'ctx, Seed, Value, Error, E: Environment> AnyTrait<'ctx> for MockBuilder<Seed, Value, Error, E>
where
Seed: DynBind<E>,
Error: DynBind<E>,
Dynamic<Value>: DynBind<E>,
{
- fn upcast_by_id<'a>(
- &'a self,
- id: treaty::any::WithLtTypeId<'lt, 'ctx>,
- ) -> Option<treaty::any::RefAnyUnsized<'a, 'lt, 'ctx>>
- where
- 'lt: 'a,
- {
+ fn upcast_by_id(
+ &self,
+ id: treaty::any::WithLtTypeId<'ctx>,
+ ) -> Option<treaty::any::RefAnyUnsized<'_, 'ctx>> {
let _id = id;
None
}
- fn upcast_by_id_mut<'a>(
- &'a mut self,
- id: treaty::any::WithLtTypeId<'lt, 'ctx>,
- ) -> Option<treaty::any::MutAnyUnsized<'a, 'lt, 'ctx>>
- where
- 'lt: 'a,
- {
- self.traits_mut()(id)
+ fn upcast_by_id_mut(
+ &mut self,
+ id: treaty::any::WithLtTypeId<'ctx>,
+ ) -> Option<treaty::any::MutAnyUnsized<'_, 'ctx>> {
+ self.traits_mut()(id, &())
}
// fn upcast_to_id<'a>(