-
Notifications
You must be signed in to change notification settings - Fork 430
feat: add #[track_caller] to functions that panic
#748
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
Conversation
798ce5f to
c705e61
Compare
|
Oops, I think I found an undocumented panic, turning into draft for now while I figure out what's going on. |
c705e61 to
de069a5
Compare
|
Done, I documented more panics. Now I'm get this panic message: I also changed wording around |
#[track_caller] to functions that panic#[track_caller] to functions that panic
#[track_caller] to functions that panic#[track_caller] to functions that panic
edec862 to
76eb2a9
Compare
|
@ABorgna ping, I solved the conflicts. |
|
Hi, nice feature! Plan to include it in the next minor release |
76eb2a9 to
3e0b4bd
Compare
starovoid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might also be worth using except instead of unwrap in Csr methods, but with the recent addition of a typed error, the messages look quite clear.
So let's leave it up to #724
## 🤖 New release * `petgraph`: 0.8.0 -> 0.8.1 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.8.1](https://github.com/petgraph/petgraph/compare/petgraph@v0.8.0...petgraph@v0.8.1) - 2025-04-07 ### Bug Fixes - Bring back `VisitMap` impl for std `HashSet` ([#764](#764)) ### New Features - Add `UnionFind` capacity management methods ([#736](#736)) - add `#[track_caller]` to functions that panic ([#748](#748)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Agustín Borgna <agustinborgna@gmail.com>
While using
AcyclicI got this panic:While expected, it'd be more helpful if it pointed to the caller in my code, not the upstream code.
I started adding
#[track_caller]forAcyclicand ended up going through all functions that contain "panics" in their docs, except forstd::ops::Index[Mut]cause those have#[track_caller]in the trait definition.