3 ms·
That seems like a great idea. I've started a branch "attempt_to_avoid_dynamic_cast" where I've tried to implement your idea: https://github.com/joelonsql/wherr
by JoelJacobson 3y ago
That seems like a great idea. I've started a branch "attempt_to_avoid_dynamic_cast" where I've tried to implement your idea:
https://github.com/joelonsql/wherr/commit/c5906a257fc9768ad0add455bbc89107d4e7d978 https://github.com/joelonsql/wherr/commit/c5906a257fc9768ad0...
I couldn't figure out how to make it work though, since with these changes, now nested functions using the #[wherr] macro won't work due to "doesn't have a size known at compile-time".
The other idea of just using #[track_caller] also seems promising, and will be considered for a future major version.
But I still think it's interesting if the macro variant can be improved, to avoid having to do dynamic casts, hence this new branch.