Skip to content

Commit 54e569c

Browse files
committed
Auto merge of rust-lang#140514 - m-ou-se:proc-macro-span-file, r=Amanieu
Stabilize proc_macro::Span::{file, local_file}. Stabilizes this part of rust-lang#54725: ```rust impl Span { pub fn file(&self) -> String; // Mapped/artificial file name, for display purposes. pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on the local file system. } ``` See also the naming discussion in rust-lang#139903
2 parents 1a95cc6 + 2a053c7 commit 54e569c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/proc_macro/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -543,18 +543,18 @@ impl Span {
543543
/// The path to the source file in which this span occurs, for display purposes.
544544
///
545545
/// This might not correspond to a valid file system path.
546-
/// It might be remapped, or might be an artificial path such as `"<macro expansion>"`.
547-
#[unstable(feature = "proc_macro_span", issue = "54725")]
546+
/// It might be remapped (e.g. `"/src/lib.rs"`) or an artificial path (e.g. `"<command line>"`).
547+
#[stable(feature = "proc_macro_span_file", since = "CURRENT_RUSTC_VERSION")]
548548
pub fn file(&self) -> String {
549549
self.0.file()
550550
}
551551

552-
/// The path to the source file in which this span occurs on disk.
552+
/// The path to the source file in which this span occurs on the local file system.
553553
///
554554
/// This is the actual path on disk. It is unaffected by path remapping.
555555
///
556556
/// This path should not be embedded in the output of the macro; prefer `file()` instead.
557-
#[unstable(feature = "proc_macro_span", issue = "54725")]
557+
#[stable(feature = "proc_macro_span_file", since = "CURRENT_RUSTC_VERSION")]
558558
pub fn local_file(&self) -> Option<PathBuf> {
559559
self.0.local_file().map(|s| PathBuf::from(s))
560560
}

0 commit comments

Comments
 (0)