[proc-macro] Add possibility to generate a `Span` from a path representation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Currently, we cannot handle Span when using the proc-macro crate, which is problematic in many cases, like askama when the generated code triggers an error and we can't show the users where in their templates the error originates from.
So an idea I had was to provide a method looking like this:
struct FileLocation {
line: u32,
column: u32,
}
fn span_from_representation(file: &Path, beginning: FileLocation, end: Option<FileLocation>) -> Option<Span>;
It would allow to get the span we need without having to manipulate the Span content (which is not possible outside of the compiler anyway).
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 by reviewing proc-macro Span handling and the proposed span_from_representation signature in the issue. Done means providing a way to derive an Option from a path and beginning/end file locations so generated errors can point to their source templates; no files or tests are identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100