lance-format / lance-format/lance
Make `location: location!()` less painful to use
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
snafu::Location is a struct we can include in our error types. The Location struct records the line at which the error is created. This is very helpful for debugging. However, there are a few drawbacks:
- We need to call
location: location!()at every error init site. This is tedious and annoying. - While the
SomethingSnafutypes generated can automatically record locations, there are complications with it as well. - It's unclear to new comers to the repo what the heck is a
Snafu - the location captured in async code is not correct without special tricks: https://docs.rs/snafu/latest/snafu/struct.Location.html#asynchronous-code
Idea: Maybe we could write a proc macro that scans for all Error init sites and inject location: location!() calls everywhere.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the issue's proposal to design a proc macro that scans error initialization sites and injects location calls. First investigate how Snafu error types and async locations currently work; done would require a concrete, agreed-upon approach that addresses both repetitive call sites and async correctness.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100