Rename `unstable` feature to `nightly`
diff --git a/.travis.yml b/.travis.yml
index e5c59af..c7f7d14 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,9 +11,9 @@
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
script:
- cargo test
- - cargo build --features unstable
+ - cargo build --features nightly
- RUSTFLAGS='--cfg procmacro2_unstable' cargo test
- - RUSTFLAGS='--cfg procmacro2_unstable' cargo build --features unstable
+ - RUSTFLAGS='--cfg procmacro2_unstable' cargo build --features nightly
- RUSTFLAGS='--cfg procmacro2_unstable' cargo doc --no-deps
after_success:
- travis-cargo --only nightly doc-upload
diff --git a/Cargo.toml b/Cargo.toml
index 19e860f..ac33607 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,4 +21,13 @@
unicode-xid = "0.1"
[features]
-unstable = []
+
+# When enabled: act as a shim around the nightly compiler's proc_macro crate.
+# This requires a nightly compiler.
+#
+# When disabled: emulate the same API as the nightly compiler's proc_macro crate
+# but in a way that works on all stable compilers >=1.15.0.
+nightly = []
+
+# Deprecated; use "nightly" instead.
+unstable = ["nightly"]
diff --git a/README.md b/README.md
index c26ec75..665678b 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@
}
```
-If you'd like you can enable the `unstable` feature in this crate. This will
+If you'd like you can enable the `nightly` feature in this crate. This will
cause it to compile against the **unstable and nightly-only** features of the
`proc_macro` crate. This in turn requires a nightly compiler. This should help
preserve span information, however, coming in from the compiler itself.
@@ -57,7 +57,7 @@
```toml
[dependencies]
-proc-macro2 = { version = "0.1", features = ["unstable"] }
+proc-macro2 = { version = "0.1", features = ["nightly"] }
```
diff --git a/src/lib.rs b/src/lib.rs
index 26d3244..153b9c8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,16 +14,16 @@
//! to use this crate will be trivially able to switch to the upstream
//! `proc_macro` crate once its API stabilizes.
//!
-//! In the meantime this crate also has an `unstable` Cargo feature which
+//! In the meantime this crate also has a `nightly` Cargo feature which
//! enables it to reimplement itself with the unstable API of `proc_macro`.
//! This'll allow immediate usage of the beneficial upstream API, particularly
//! around preserving span information.
-#![cfg_attr(feature = "unstable", feature(proc_macro))]
+#![cfg_attr(feature = "nightly", feature(proc_macro))]
extern crate proc_macro;
-#[cfg(not(feature = "unstable"))]
+#[cfg(not(feature = "nightly"))]
extern crate unicode_xid;
use std::fmt;
@@ -31,14 +31,14 @@
use std::iter::FromIterator;
#[macro_use]
-#[cfg(not(feature = "unstable"))]
+#[cfg(not(feature = "nightly"))]
mod strnom;
#[path = "stable.rs"]
-#[cfg(not(feature = "unstable"))]
+#[cfg(not(feature = "nightly"))]
mod imp;
#[path = "unstable.rs"]
-#[cfg(feature = "unstable")]
+#[cfg(feature = "nightly")]
mod imp;
#[macro_use]
@@ -162,8 +162,8 @@
Span(imp::Span::def_site())
}
- /// This method is only available when the `"unstable"` feature is enabled.
- #[cfg(feature = "unstable")]
+ /// This method is only available when the `"nightly"` feature is enabled.
+ #[cfg(feature = "nightly")]
pub fn unstable(self) -> proc_macro::Span {
self.0.unstable()
}
diff --git a/tests/test.rs b/tests/test.rs
index 6442ba6..8320876 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -6,7 +6,7 @@
use proc_macro2::TokenNode;
#[cfg(procmacro2_unstable)]
-#[cfg(not(feature = "unstable"))]
+#[cfg(not(feature = "nightly"))]
use proc_macro2::Span;
#[test]
@@ -121,7 +121,7 @@
}
#[cfg(procmacro2_unstable)]
-#[cfg(not(feature = "unstable"))]
+#[cfg(not(feature = "nightly"))]
#[test]
fn default_span() {
let start = Span::call_site().start();