Rename Span::unstable to Span::unwrap
diff --git a/build.rs b/build.rs
index a175711..6973ca7 100644
--- a/build.rs
+++ b/build.rs
@@ -24,7 +24,7 @@
// Enabled on rustc 1.29 only.
//
// "nightly"
-// Enable the Span::unstable method. This is to support proc_macro_span and
+// Enable the Span::unwrap method. This is to support proc_macro_span and
// proc_macro_diagnostic use on the nightly channel without requiring the
// semver exemption opt-in. Enabled when building with nightly.
//
diff --git a/src/lib.rs b/src/lib.rs
index fd49f01..fc12835 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -344,8 +344,15 @@
/// `proc_macro2::Span`, the `proc_macro::Span` type can only exist within
/// the context of a procedural macro invocation.
#[cfg(wrap_proc_macro)]
+ pub fn unwrap(self) -> proc_macro::Span {
+ self.inner.unwrap()
+ }
+
+ // Soft deprecated. Please use Span::unwrap.
+ #[cfg(wrap_proc_macro)]
+ #[doc(hidden)]
pub fn unstable(self) -> proc_macro::Span {
- self.inner.unstable()
+ self.unwrap()
}
/// The original source file into which this span points.
diff --git a/src/wrapper.rs b/src/wrapper.rs
index 8ead052..f2121be 100644
--- a/src/wrapper.rs
+++ b/src/wrapper.rs
@@ -460,7 +460,7 @@
}
}
- pub fn unstable(self) -> proc_macro::Span {
+ pub fn unwrap(self) -> proc_macro::Span {
match self {
Span::Compiler(s) => s,
Span::Fallback(_) => panic!("proc_macro::Span is only available in procedural macros"),