Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Provide an API to access byte offsets for Spans #439

Closed
buchgr opened this issue Jan 18, 2024 · 0 comments · Fixed by #442
Closed

Provide an API to access byte offsets for Spans #439

buchgr opened this issue Jan 18, 2024 · 0 comments · Fixed by #442

Comments

@buchgr
Copy link
Contributor

buchgr commented Jan 18, 2024

In Rust Nightly proc_macro::Span has a method byte_range(). Having access to byte offsets in addition to (line, column) information is useful to some applications, including my own. I understand that byte_range() is currently only available in the nightly version, but proc_macro2::Span could expose byte offsets today when used in a main.rs context.

David, would you accept a PR that exposes byte offsets via proc_macro2::Span?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant