Skip to content

Conversation

@chrysn
Copy link

@chrysn chrysn commented Nov 26, 2024

The panic location printed by a panicking .expect() call is not helpful -- it points to subtle instead of the code that had the expectation.

I was lucky that the error message was usable in the message I got:

thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/subtle-2.6.1/src/lib.rs:692:9: assertion `left == right` failed: Public key is not a good point left: 0 right: 1 

but still had to look around a bit for where that came from precisely. With the annotation added in this PR, the compiler will make an effort to produce a more helpful location: the one expect()'s caller.

(Most other functions on this type are #[inline], and I don't know whether or not inline also has that effect, but at any rate, this function is the one that describes a panic, and that's where track_caller is needed the most).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant