Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[proc-macro] Add possibility to generate a Span from a path representation #140943

Open
Labels
A-proc-macrosArea: Procedural macros C-feature-requestCategory: A feature request, i.e: not implemented / a PR. T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
@GuillaumeGomez

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-proc-macrosArea: Procedural macros C-feature-requestCategory: A feature request, i.e: not implemented / a PR. T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /