Skip to content

Commit 16a1720

Browse files
committed
Span::unstable to expose the proc_macro::Span
1 parent 92ab1b4 commit 16a1720

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ impl Span {
162162
Span(imp::Span::def_site())
163163
}
164164

165+
/// This method is only available when the `"unstable"` feature is enabled.
166+
#[cfg(feature = "unstable")]
167+
pub fn unstable(self) -> proc_macro::Span {
168+
self.0.unstable()
169+
}
170+
165171
#[cfg(procmacro2_unstable)]
166172
pub fn source_file(&self) -> SourceFile {
167173
SourceFile(self.0.source_file())

src/unstable.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ impl Span {
225225
Span(proc_macro::Span::def_site())
226226
}
227227

228+
pub fn unstable(self) -> proc_macro::Span {
229+
self.0
230+
}
231+
228232
#[cfg(procmacro2_unstable)]
229233
pub fn source_file(&self) -> SourceFile {
230234
SourceFile::new(self.0.source_file())

0 commit comments

Comments
 (0)