Skip to content

Commit 9675743

Browse files
committed
Only include the await! macro when compiling with nightly Rust
1 parent 167480f commit 9675743

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ unstable = []
1313

1414
[dev-dependencies]
1515
futures = "0.1.17"
16+
17+
[build-dependencies]
18+
version_check = "0.9"

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extern crate version_check;
2+
3+
fn main() {
4+
println!("cargo:rerun-if-changed=build.rs");
5+
match version_check::Channel::read() {
6+
Some(c) if c.is_nightly() => println!("cargo:rustc-cfg=nightly"),
7+
_ => (),
8+
}
9+
}

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@
7474
//! [`block!`], [`try_nb!`] and [`await!`] macros to adapt it for blocking
7575
//! operation, or for non-blocking operation with `futures` or `await`.
7676
//!
77-
//! **NOTE** Currently, both `try_nb!` and `await!` are feature gated behind the `unstable` Cargo
77+
//! **NOTE**: Currently, both `try_nb!` and `await!` are feature gated behind the `unstable` Cargo
7878
//! feature.
7979
//!
80+
//! **NOTE2**: The `await!` macro is only available when compiling on nightly Rust.
81+
//!
8082
//! [`block!`]: macro.block.html
8183
//! [`try_nb!`]: macro.try_nb.html
8284
//! [`await!`]: macro.await.html
@@ -429,7 +431,7 @@ impl<E> From<E> for Error<E> {
429431
///
430432
/// - `Ok(t)` if `$e` evaluates to `Ok(t)`
431433
/// - `Err(e)` if `$e` evaluates to `Err(nb::Error::Other(e))`
432-
#[cfg(feature = "unstable")]
434+
#[cfg(nightly)]
433435
#[macro_export]
434436
macro_rules! await {
435437
($e:expr) => {

0 commit comments

Comments
 (0)