diff --git a/Cargo.toml b/Cargo.toml index 7aad001..aaba1d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,6 @@ unstable = [] [dev-dependencies] futures = "0.1.17" + +[build-dependencies] +version_check = "0.9" \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..2afc6bf --- /dev/null +++ b/build.rs @@ -0,0 +1,9 @@ +extern crate version_check; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + match version_check::Channel::read() { + Some(c) if c.is_nightly() => println!("cargo:rustc-cfg=nightly"), + _ => (), + } +} diff --git a/src/lib.rs b/src/lib.rs index 3bc561d..ecd0a53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,9 +74,11 @@ //! [`block!`], [`try_nb!`] and [`await!`] macros to adapt it for blocking //! operation, or for non-blocking operation with `futures` or `await`. //! -//! **NOTE** Currently, both `try_nb!` and `await!` are feature gated behind the `unstable` Cargo +//! **NOTE**: Currently, both `try_nb!` and `await!` are feature gated behind the `unstable` Cargo //! feature. //! +//! **NOTE2**: The `await!` macro is only available when compiling on nightly Rust. +//! //! [`block!`]: macro.block.html //! [`try_nb!`]: macro.try_nb.html //! [`await!`]: macro.await.html @@ -429,7 +431,7 @@ impl<E> From<E> for Error<E> { /// /// - `Ok(t)` if `$e` evaluates to `Ok(t)` /// - `Err(e)` if `$e` evaluates to `Err(nb::Error::Other(e))` -#[cfg(feature = "unstable")] +#[cfg(nightly)] #[macro_export] macro_rules! await { ($e:expr) => {