Skip to content

Commit 86878c8

Browse files
authored
Merge pull request #97 from Dirbaio/feature-nightly-only
Use `feature()` on nightly toolchains only.
2 parents e39a13d + 6e4e73b commit 86878c8

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

embedded-nal-async/build.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use std::env;
2+
use std::ffi::OsString;
3+
use std::process::Command;
4+
5+
fn main() {
6+
println!("cargo:rerun-if-changed=build.rs");
7+
8+
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
9+
10+
let output = Command::new(rustc)
11+
.arg("--version")
12+
.output()
13+
.expect("failed to run `rustc --version`");
14+
15+
if String::from_utf8_lossy(&output.stdout).contains("nightly") {
16+
println!("cargo:rustc-cfg=nightly");
17+
}
18+
}

embedded-nal-async/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! # embedded-nal-async - An async Network Abstraction Layer for Embedded Systems
22
33
#![no_std]
4-
#![feature(async_fn_in_trait, impl_trait_projections)]
5-
#![allow(stable_features, unknown_lints, async_fn_in_trait)]
4+
#![cfg_attr(nightly, allow(stable_features, unknown_lints))]
5+
#![cfg_attr(nightly, feature(async_fn_in_trait, impl_trait_projections))]
6+
#![allow(async_fn_in_trait)]
67
#![deny(missing_docs)]
78
#![deny(unsafe_code)]
89
#![cfg_attr(feature = "ip_in_core", feature(ip_in_core))]

0 commit comments

Comments
 (0)