Infer nightly feature on nightly toolchain
Before this commit, enabling procmacro2_semver_exempt would disable
wrap_proc_macro, meaning that real spans would not be preserved by proc
macros. One would also need to enable the "nightly" feature in order to
preserve spans when using procmacro2_semver_exempt.
This commit automatically enables wrap_proc_macro when building with
procmacro2_semver_exempt on a nightly compiler.
diff --git a/src/lib.rs b/src/lib.rs
index db51272..347b937 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -333,9 +333,11 @@
Span::_new(self.inner.located_at(other.inner))
}
- /// This method is only available when the `"nightly"` feature is enabled.
- #[doc(hidden)]
- #[cfg(any(feature = "nightly", super_unstable))]
+ /// Convert `proc_macro2::Span` to `proc_macro::Span`.
+ ///
+ /// This method is available when building with a nightly compiler, or when
+ /// building with rustc 1.29+ *without* semver exempt features.
+ #[cfg(wrap_proc_macro)]
pub fn unstable(self) -> proc_macro::Span {
self.inner.unstable()
}