Skip to content

Commit

Permalink
🎁 add nightly detection build
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Sep 1, 2017
1 parent 37f2ba0 commit 6a664f5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ description = "Generator Library in Rust"
readme = "README.md"
keywords = ["generator", "coroutine", "green", "thread", "fiber"]
categories = ["data-structures", "algorithms"]
build = "build.rs"

[dependencies]
log = "0.3"

[build-dependencies]
rustc_version = "0.2"

[profile.release]
opt-level=3
11 changes: 11 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extern crate rustc_version;
use rustc_version::{version_meta, Channel};

fn main() {
// Set cfg flags depending on release channel
if let Channel::Nightly = version_meta().unwrap().channel {
return println!("cargo:rustc-cfg=nightly");
}

panic!("stable build is not supported now!");
}
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
//! Rust generator library
//!
#![feature(asm)]
#![feature(alloc)]
#![feature(fnbox)]
#![feature(rustc_private)]
#![feature(naked_functions)]
#![feature(core_intrinsics)]
#![feature(repr_simd)]
#![cfg_attr(nightly, feature(asm))]
#![cfg_attr(nightly, feature(alloc))]
#![cfg_attr(nightly, feature(fnbox))]
#![cfg_attr(nightly, feature(naked_functions))]
#![cfg_attr(nightly, feature(core_intrinsics))]
#![cfg_attr(nightly, feature(repr_simd))]

#![cfg_attr(test, deny(warnings))]
#![deny(missing_docs)]

#[macro_use]
extern crate log;
#[cfg(nightly)]
extern crate alloc;

mod rt;
Expand Down

1 comment on commit 6a664f5

@Xudong-Huang
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref #1

Please sign in to comment.