You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using momo on an associated function (without a self parameter), the generated code fails, since the call to the non-generic function is missing the Self:: prefix.
Make #[momo] work on impl blocks, transforming all functions. IMO, this would cover all use cases, but I may have missed some edge cases. Might also be a bigger rewrite.
Detect usage of Self type in function (signature) and generate calls with Self::. While this would cover the described problem, it is only a best-effort heuristic and may miss cases.
Generate an inner function. AFAICT, this is the common way to write this manually. However, it also runs into issues with the Self type, but in the opposite direction. We would need to spell out Self as the full type everywhere. It also won't work with generic structs, as the inner function cannot reference the generics from the type/impl block.
Generate a nested closure and convert to a function pointer. This requires a bit of setup but can be made to be equivalent to the nested function code:
When using
momo
on an associated function (without aself
parameter), the generated code fails, since the call to the non-generic function is missing theSelf::
prefix.Example code demonstrating the problem:
And the corresponding expansion:
Possible alternatives:
#[momo]
work onimpl
blocks, transforming all functions. IMO, this would cover all use cases, but I may have missed some edge cases. Might also be a bigger rewrite.Self
type in function (signature) and generate calls withSelf::
. While this would cover the described problem, it is only a best-effort heuristic and may miss cases.Self
type, but in the opposite direction. We would need to spell outSelf
as the full type everywhere. It also won't work with generic structs, as the inner function cannot reference the generics from the type/impl
block.The text was updated successfully, but these errors were encountered: