-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
feature()
on nightly toolchains only.
`feature()` is only allowed on Nightly, it's completely disallowed on stable and beta even for already-stabilized features. So, we autodetect whether the user is using nightly and conditionally use `feature()`. This allows the crates to Just Work on current 1.75 beta and will also Just Work when 1.75 stable is out. Keeping `feature()` is desirable to keep support for: - Espressif's xtensa rustc fork. (they build from the stable branch but enable use of `feature()`, so latest xtensa rustc still requires `feature()`) - Users of older nightlies Once xtensa rust 1.75 is out, we can remove this (upstream nightlies that require `feature()` will be quite old by then, so dropping support for them should be OK). I decided to not use already-made crates like `rustversion` to do this because they're quite big and do way more than what we need, so I felt badd adding another dep. The code is inspired from `rustversion`'s build.rs.
- Loading branch information
Showing
8 changed files
with
83 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::env; | ||
use std::ffi::OsString; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build/build.rs"); | ||
|
||
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
|
||
let output = Command::new(rustc) | ||
.arg("--version") | ||
.output() | ||
.expect("failed to run `rustc --version`"); | ||
|
||
if String::from_utf8_lossy(&output.stdout).contains("nightly") { | ||
println!("cargo:rustc-cfg=nightly"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::env; | ||
use std::ffi::OsString; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build/build.rs"); | ||
|
||
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
|
||
let output = Command::new(rustc) | ||
.arg("--version") | ||
.output() | ||
.expect("failed to run `rustc --version`"); | ||
|
||
if String::from_utf8_lossy(&output.stdout).contains("nightly") { | ||
println!("cargo:rustc-cfg=nightly"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::env; | ||
use std::ffi::OsString; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build/build.rs"); | ||
|
||
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
|
||
let output = Command::new(rustc) | ||
.arg("--version") | ||
.output() | ||
.expect("failed to run `rustc --version`"); | ||
|
||
if String::from_utf8_lossy(&output.stdout).contains("nightly") { | ||
println!("cargo:rustc-cfg=nightly"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::env; | ||
use std::ffi::OsString; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build/build.rs"); | ||
|
||
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
|
||
let output = Command::new(rustc) | ||
.arg("--version") | ||
.output() | ||
.expect("failed to run `rustc --version`"); | ||
|
||
if String::from_utf8_lossy(&output.stdout).contains("nightly") { | ||
println!("cargo:rustc-cfg=nightly"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters