summaryrefslogtreecommitdiff
path: root/macros/src/expectation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/expectation.rs')
-rw-r--r--macros/src/expectation.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/macros/src/expectation.rs b/macros/src/expectation.rs
index 8120cfd..2e86db0 100644
--- a/macros/src/expectation.rs
+++ b/macros/src/expectation.rs
@@ -180,7 +180,6 @@ impl Expectation
ident: Ident,
generics: Generics,
phantom_fields: &[PhantomField],
- returning_fn: &Type,
boxed_predicate_types: &[Type],
) -> ItemStruct
{
@@ -208,7 +207,9 @@ impl Expectation
format_ident!("Option"),
Some(AngleBracketedGenericArguments::new(
WithColons::No,
- [GenericArgument::Type(returning_fn.clone())],
+ [GenericArgument::Type(Type::BareFn(
+ TypeBareFn::new([], ReturnType::Default),
+ ))],
)),
)],
))),
@@ -345,7 +346,6 @@ impl ToTokens for Expectation
self.ident.clone(),
generics.clone(),
phantom_fields,
- &returning_fn,
&boxed_predicate_types,
);
@@ -445,7 +445,7 @@ impl ToTokens for Expectation
func: #returning_fn
) -> &mut Self
{
- self.returning = Some(func);
+ self.returning = Some(unsafe { std::mem::transmute(func) });
self
}
@@ -536,7 +536,9 @@ impl ToTokens for Expectation
self.call_cnt.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
- returning
+ let returning_ptr: *const _ = returning;
+
+ unsafe { &*returning_ptr.cast()}
}
}