diff --git a/src/lib.rs b/src/lib.rs index fd464333..26d32446 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -162,6 +162,12 @@ impl Span { Span(imp::Span::def_site()) } + /// This method is only available when the `"unstable"` feature is enabled. + #[cfg(feature = "unstable")] + pub fn unstable(self) -> proc_macro::Span { + self.0.unstable() + } + #[cfg(procmacro2_unstable)] pub fn source_file(&self) -> SourceFile { SourceFile(self.0.source_file()) diff --git a/src/unstable.rs b/src/unstable.rs index 41b9f640..56df0dd3 100644 --- a/src/unstable.rs +++ b/src/unstable.rs @@ -225,6 +225,10 @@ impl Span { Span(proc_macro::Span::def_site()) } + pub fn unstable(self) -> proc_macro::Span { + self.0 + } + #[cfg(procmacro2_unstable)] pub fn source_file(&self) -> SourceFile { SourceFile::new(self.0.source_file())