Skip to content

Commit d66ecf6

Browse files
committed
Rename unstable feature to nightly
1 parent fa1864f commit d66ecf6

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ matrix:
1111
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
1212
script:
1313
- cargo test
14-
- cargo build --features unstable
14+
- cargo build --features nightly
1515
- RUSTFLAGS='--cfg procmacro2_unstable' cargo test
16-
- RUSTFLAGS='--cfg procmacro2_unstable' cargo build --features unstable
16+
- RUSTFLAGS='--cfg procmacro2_unstable' cargo build --features nightly
1717
- RUSTFLAGS='--cfg procmacro2_unstable' cargo doc --no-deps
1818
after_success:
1919
- travis-cargo --only nightly doc-upload

Cargo.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@ doctest = false
2121
unicode-xid = "0.1"
2222

2323
[features]
24-
unstable = []
24+
25+
# When enabled: act as a shim around the nightly compiler's proc_macro crate.
26+
# This requires a nightly compiler.
27+
#
28+
# When disabled: emulate the same API as the nightly compiler's proc_macro crate
29+
# but in a way that works on all stable compilers >=1.15.0.
30+
nightly = []
31+
32+
# Deprecated; use "nightly" instead.
33+
unstable = ["nightly"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
4848
}
4949
```
5050

51-
If you'd like you can enable the `unstable` feature in this crate. This will
51+
If you'd like you can enable the `nightly` feature in this crate. This will
5252
cause it to compile against the **unstable and nightly-only** features of the
5353
`proc_macro` crate. This in turn requires a nightly compiler. This should help
5454
preserve span information, however, coming in from the compiler itself.
@@ -57,7 +57,7 @@ You can enable this feature via:
5757

5858
```toml
5959
[dependencies]
60-
proc-macro2 = { version = "0.1", features = ["unstable"] }
60+
proc-macro2 = { version = "0.1", features = ["nightly"] }
6161
```
6262

6363

src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@
1414
//! to use this crate will be trivially able to switch to the upstream
1515
//! `proc_macro` crate once its API stabilizes.
1616
//!
17-
//! In the meantime this crate also has an `unstable` Cargo feature which
17+
//! In the meantime this crate also has a `nightly` Cargo feature which
1818
//! enables it to reimplement itself with the unstable API of `proc_macro`.
1919
//! This'll allow immediate usage of the beneficial upstream API, particularly
2020
//! around preserving span information.
2121
22-
#![cfg_attr(feature = "unstable", feature(proc_macro))]
22+
#![cfg_attr(feature = "nightly", feature(proc_macro))]
2323

2424
extern crate proc_macro;
2525

26-
#[cfg(not(feature = "unstable"))]
26+
#[cfg(not(feature = "nightly"))]
2727
extern crate unicode_xid;
2828

2929
use std::fmt;
3030
use std::str::FromStr;
3131
use std::iter::FromIterator;
3232

3333
#[macro_use]
34-
#[cfg(not(feature = "unstable"))]
34+
#[cfg(not(feature = "nightly"))]
3535
mod strnom;
3636

3737
#[path = "stable.rs"]
38-
#[cfg(not(feature = "unstable"))]
38+
#[cfg(not(feature = "nightly"))]
3939
mod imp;
4040
#[path = "unstable.rs"]
41-
#[cfg(feature = "unstable")]
41+
#[cfg(feature = "nightly")]
4242
mod imp;
4343

4444
#[macro_use]
@@ -162,8 +162,8 @@ impl Span {
162162
Span(imp::Span::def_site())
163163
}
164164

165-
/// This method is only available when the `"unstable"` feature is enabled.
166-
#[cfg(feature = "unstable")]
165+
/// This method is only available when the `"nightly"` feature is enabled.
166+
#[cfg(feature = "nightly")]
167167
pub fn unstable(self) -> proc_macro::Span {
168168
self.0.unstable()
169169
}

tests/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use proc_macro2::{Term, Literal, TokenStream};
66
use proc_macro2::TokenNode;
77

88
#[cfg(procmacro2_unstable)]
9-
#[cfg(not(feature = "unstable"))]
9+
#[cfg(not(feature = "nightly"))]
1010
use proc_macro2::Span;
1111

1212
#[test]
@@ -121,7 +121,7 @@ testing 123
121121
}
122122

123123
#[cfg(procmacro2_unstable)]
124-
#[cfg(not(feature = "unstable"))]
124+
#[cfg(not(feature = "nightly"))]
125125
#[test]
126126
fn default_span() {
127127
let start = Span::call_site().start();

0 commit comments

Comments
 (0)