This currently yields a compile error due to missing T: 'static. But it's still possible to mock it, in a more limited sense. If the T is replaced with unimock::Impossible it's doable. What will be missing then is argument matching and access to the parameter in AnswerFn.
Consider using a different Impossible-like variant like MissingStaticBound, to serve as a diagnostic hint.
A problem is that it's impossible to statically detect whether a trait already has an implicit 'static bound. I think a solution to that could be something like:
Of course, the macro should just require a syntactic + 'static even if implicit from the trait definition. With a MissingStaticBound error type, it should be clear why that parameter is left out.
(from https://stackoverflow.com/questions/76818001/use-mockall-crate-for-a-trait-with-trait-bounds)
This currently yields a compile error due to missing
T: 'static
. But it's still possible to mock it, in a more limited sense. If theT
is replaced withunimock::Impossible
it's doable. What will be missing then is argument matching and access to the parameter inAnswerFn
.Consider using a different
Impossible
-like variant likeMissingStaticBound
, to serve as a diagnostic hint.A problem is that it's impossible to statically detect whether a trait already has an implicit
'static
bound. I think a solution to that could be something like:if that's not too big of a hammer. I'd like to avoid sub-attributes for unimock, since those are difficult to combine with
cfg_attr
.