Tracking issue for `proc_macro::Span` inspection APIs
<!-- homu-ignore:start --> *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/issues/54725)* <!-- homu-ignore:end --> This issue is intended to track a number of unstable APIs which are used to inspect the contents of a `Span` for information like the file name, byte position, manufacturing new spans, combining them, etc. This issue tracks the `proc_macro_span` unstable feature. ### Public API Already stabilized: ```rust impl Span { // as `proc_macro_source_text` pub fn source_text(&self) -> Option<String>; // as `proc_macro_span_location` pub fn start(&self) -> Span; pub fn end(&self) -> Span; pub fn line(&self) -> usize; pub fn column(&self) -> usize; // as `proc_macro_span_file` pub fn file(&self) -> String; // Mapped file name, for display purposes. pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk. } impl Group { // as `proc_macro_group_span` pub fn span_open(&self) -> Span; pub fn span_close(&self) -> Span; } ``` Close to stabilization, pending some bikeshedding: ```rust impl Span { pub fn byte_range(&self) -> Range<usize>; // Open question: Do we want to use the old or new Range type? } ``` Things that require more discussion: ```rust impl Span { pub fn eq(&self, other: &Span) -> bool; pub fn join(&self, other: Span) -> Option<Span>; pub fn parent(&self) -> Option<Span>; pub fn source(&self) -> Span; } impl Litera
Posted by alexcrichton on Oct 1, 2018, 5:52 PM
Tags
Related issues
- Custom games stuck on "finding server" for all european servers
- Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
- Forza Horizon 6 (2483190)
- Turn off integrated browser for default
- Weekly updates are too frequent
- [BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Sysadmin)
Custom games stuck on "finding server" for all european servers
Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
Forza Horizon 6 (2483190)
Turn off integrated browser for default
Weekly updates are too frequent
[BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Add gemini-3.1-pro-preview
[TF2] Feature request: Bring Back Quickplay
Tracking issue for `proc_macro::Span` inspection APIs
<!-- homu-ignore:start --> *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/issues/54725)* <!-- homu-ignore:end --> This issue is intended to track a number of unstable APIs which are used to inspect the contents of a `Span` for information like the file name, byte position, manufacturing new spans, combining them, etc. This issue tracks the `proc_macro_span` unstable feature. ### Public API Already stabilized: ```rust impl Span { // as `proc_macro_source_text` pub fn source_text(&self) -> Option<String>; // as `proc_macro_span_location` pub fn start(&self) -> Span; pub fn end(&self) -> Span; pub fn line(&self) -> usize; pub fn column(&self) -> usize; // as `proc_macro_span_file` pub fn file(&self) -> String; // Mapped file name, for display purposes. pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk. } impl Group { // as `proc_macro_group_span` pub fn span_open(&self) -> Span; pub fn span_close(&self) -> Span; } ``` Close to stabilization, pending some bikeshedding: ```rust impl Span { pub fn byte_range(&self) -> Range<usize>; // Open question: Do we want to use the old or new Range type? } ``` Things that require more discussion: ```rust impl Span { pub fn eq(&self, other: &Span) -> bool; pub fn join(&self, other: Span) -> Option<Span>; pub fn parent(&self) -> Option<Span>; pub fn source(&self) -> Span; } impl Litera
Comments (0)
No comments yet. Start the discussion.