Merge pull request #41 from alexcrichton/unstable

Span::unstable to expose the proc_macro::Span
This commit is contained in:
Alex Crichton 2017-12-31 11:15:15 -06:00 committed by GitHub
commit 31ac177a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -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())

View File

@ -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())