rust-decimal icon indicating copy to clipboard operation
rust-decimal copied to clipboard

`track_caller`

Open fenhl opened this issue 6 months ago • 1 comments

It would be useful if operations that can panic were marked with #[track_caller] to make it easier to find the location of e.g. division-by-0 errors.

fenhl avatar Jul 02 '25 15:07 fenhl

So it looks like the purpose of this function is to give the first guess at to where to attribute a panic to when not printing a full callstack.

https://doc.rust-lang.org/reference/attributes/codegen.html#examples

If I understand this correctly, then the work is to:

  • Identify internal functions that call panic and add the #[track_caller] attribute to them
  • Recursively identify all functions that call functions that have the #[track_caller] and add the #[track_caller] attribute to them

And that should be it.

Tony-Samuels avatar Jul 04 '25 00:07 Tony-Samuels