forked from indexmap-rs/indexmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a feature to explicitly enable "std"
If you know you need "std", e.g. relying on default `S = RandomState`, then you can enable this feature to force it on, bypassing target detection. This may help scenarios where `autocfg` fails detection, like issue indexmap-rs#144, but at the very least it will speed up the build script by avoiding extra `rustc` invocations.
- Loading branch information
Showing
3 changed files
with
11 additions
and
2 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
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
fn main() { | ||
let ac = autocfg::new(); | ||
ac.emit_sysroot_crate("std"); | ||
// If "std" is explicitly requested, don't bother probing the target for it. | ||
match std::env::var_os("CARGO_FEATURE_STD") { | ||
Some(_) => autocfg::emit("has_std"), | ||
None => autocfg::new().emit_sysroot_crate("std"), | ||
} | ||
autocfg::rerun_path("build.rs"); | ||
} |