Skip to content

Commit

Permalink
Merge pull request #41 from alexcrichton/unstable
Browse files Browse the repository at this point in the history
Span::unstable to expose the proc_macro::Span
  • Loading branch information
alexcrichton authored Dec 31, 2017
2 parents 0957edd + 16a1720 commit 31ac177
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 4 additions & 0 deletions src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 31ac177

Please sign in to comment.