Skip to content

Conversation

onlycs
Copy link

@onlycs onlycs commented Mar 6, 2024

closes #142

#[derive(Debug, Error)]
struct MyError {
  #[from] err: SomeOtherError,
  #[location] /*optional attr*/ location: &'static Location<'static>,
}

@onlycs onlycs changed the title Create the location field and the #[location] attr, to be used with &'static core::panic::Location<'static> [Feature] std::panic::Location support Mar 6, 2024
@mpalmer
Copy link

mpalmer commented Jun 12, 2024

This is a solid change. I've started using it in a project of mine and it's working great.

@juntyr
Copy link

juntyr commented Jul 16, 2024

+1

sync fork
@ishbir
Copy link

ishbir commented Sep 27, 2024

Anything blocking the merge of this? It would be a great feature to have!

@SirMishaa
Copy link

Working for this one to be merged too, any plans ? 👀

@onlycs
Copy link
Author

onlycs commented Jan 31, 2025

I'm gonna resolve the merge conflicts at some point but this should be working on the latest version soon™

I have like, negative free time rn.

@onlycs
Copy link
Author

onlycs commented Feb 7, 2025

this is up-to-date and ready. all tests completed successfully

@dtolnay can this merge?

tgrushka added a commit to dra11y/wherror that referenced this pull request Jul 21, 2025
Implements automatic call site location capture for error types with
&'static Location<'static> fields. Location fields are automatically
populated when From trait conversions occur, enabling precise error
location tracking without manual instrumentation.

Features:
- Auto-detection of Location<'static> fields in structs and enum variants
- Optional #[location] attribute for explicit field marking
- Automatic From impl generation with #[track_caller]
- Support for both named and tuple enum variants
- Location populated via Location::caller() during From conversion
- No #[from] attribute required on location fields

Based on dtolnay#291 by @onlycs (Angad Tendulkar)
Closes dtolnay#142 - Support for tracing with std::panic::Location

Co-authored-by: Angad Tendulkar <[email protected]>
tgrushka added a commit to dra11y/wherror that referenced this pull request Jul 21, 2025
- Rebrand from thiserror to wherror across all packages
- Add comprehensive README documentation for location feature
- Update all imports and references throughout codebase
- Add location support implementation with automatic call site capture
- Include proper attribution to original thiserror and PR dtolnay#291 authors
@Bolognafingers
Copy link

This would be amazing to see merged <3

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.

Support for tracing with Std::panic::Location (Feature Request)
6 participants