Consequences of annotating every single crate function with `track_caller` attribute
⚓ Rust 📅 2025-05-04 👤 surdeus 👁️ 10I am writing a wrapper for C++ library and one of the requirements is to catch all exceptions and convert them to Result (similar to how autocxx does things).
Now, just returning a value from a function works, but I would like to annotate it with at least a line where the call failed (if not a callstack).
This I can do with Location and track_caller attribute, but since it is expected that almost every single function can throw an exception, I would need to annotate all of them. And the question is what are the consequences of doing that? Performance issues? Increased binary sized? Something else? It is just that there should be a reason why track_caller is not a default attribute.
Would be glad for any help!
1 post - 1 participant
🏷️ rust_feed