Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce track_caller for panicing methods of ExecuteKernel #50

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

9SMTM6
Copy link
Contributor

@9SMTM6 9SMTM6 commented Jul 10, 2022

This adds track_caller attributes to improve debugging for library users, as suggested in #49.

I did test it in my own project, worked as expected, for both the panic! and also the assert! calls.

  • https://doc.rust-lang.org/stable/reference/attributes/codegen.html?highlight=track_call#the-track_caller-attribute
  • for future reference, if any path in the library panics all that needs to be done for the panic to show the location in the users code is mark all functions along the call-stack with track_caller
  • I did try and test the behavior, (with unit-tests) because I can be masocistic like that, but decided to give up on it, I would have to manually temporarily switch the panic_hook during testing, if that even works. Ugly, and if it happens to work its not guaranteed to continue working.

* https://doc.rust-lang.org/stable/reference/attributes/codegen.html?highlight=track_call#the-track_caller-attribute
* for future reference, if any path in the library panics all that needs to be done for the panic to show the location in the users code is mark all functions along the call-stack with track_caller
* I did try and test the behavior, because I can be masocistic like that, but decided to give up on it, I would have to manually temporarily switch the panic_hook during testing, if that even works. Ugly, and if it happens to work its not guaranteed to continue working.
@kenba kenba closed this Jul 11, 2022
@kenba kenba reopened this Jul 11, 2022
@kenba kenba merged commit b3be615 into kenba:develop Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants