From d6ae459af8da8f5c751ad5cd8765a48778e419bb Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 30 Apr 2025 15:09:34 +0200 Subject: [PATCH 1/2] Stabilize proc_macro::Span::{file, local_file}. --- library/proc_macro/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 36a1c57b02012..7dbb9dadd8813 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -544,7 +544,7 @@ impl Span { /// /// This might not correspond to a valid file system path. /// It might be remapped, or might be an artificial path such as `""`. - #[unstable(feature = "proc_macro_span", issue = "54725")] + #[stable(feature = "proc_macro_span_file", since = "CURRENT_RUSTC_VERSION")] pub fn file(&self) -> String { self.0.file() } @@ -554,7 +554,7 @@ impl Span { /// This is the actual path on disk. It is unaffected by path remapping. /// /// This path should not be embedded in the output of the macro; prefer `file()` instead. - #[unstable(feature = "proc_macro_span", issue = "54725")] + #[stable(feature = "proc_macro_span_file", since = "CURRENT_RUSTC_VERSION")] pub fn local_file(&self) -> Option { self.0.local_file().map(|s| PathBuf::from(s)) } From 2a053c7a1532da2d8f60ac5a8f92b3e4e80d82d5 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 30 Apr 2025 15:14:20 +0200 Subject: [PATCH 2/2] Update doc comments. --- library/proc_macro/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 7dbb9dadd8813..79e9b8430b8d5 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -543,13 +543,13 @@ impl Span { /// The path to the source file in which this span occurs, for display purposes. /// /// This might not correspond to a valid file system path. - /// It might be remapped, or might be an artificial path such as `""`. + /// It might be remapped (e.g. `"/src/lib.rs"`) or an artificial path (e.g. `""`). #[stable(feature = "proc_macro_span_file", since = "CURRENT_RUSTC_VERSION")] pub fn file(&self) -> String { self.0.file() } - /// The path to the source file in which this span occurs on disk. + /// The path to the source file in which this span occurs on the local file system. /// /// This is the actual path on disk. It is unaffected by path remapping. ///