cbe24024bb
This is the hash map implementation now used in the Rust standard library: * https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#a-new-hashmapk-v-implementation * https://github.com/rust-lang/rust/pull/58623 * https://crates.io/crates/hashbrown Differential Revision: https://phabricator.services.mozilla.com/D71740 |
||
---|---|---|
.. | ||
examples | ||
src | ||
tests | ||
.cargo-checksum.json | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |
README.md
autocfg
A Rust library for build scripts to automatically configure code based on
compiler support. Code snippets are dynamically tested to see if the rustc
will accept them, rather than hard-coding specific version support.
Usage
Add this to your Cargo.toml
:
[build-dependencies]
autocfg = "1"
Then use it in your build.rs
script to detect compiler features. For
example, to test for 128-bit integer support, it might look like:
extern crate autocfg;
fn main() {
let ac = autocfg::new();
ac.emit_has_type("i128");
// (optional) We don't need to rerun for anything external.
autocfg::rerun_path("build.rs");
}
If the type test succeeds, this will write a cargo:rustc-cfg=has_i128
line
for Cargo, which translates to Rust arguments --cfg has_i128
. Then in the
rest of your Rust code, you can add #[cfg(has_i128)]
conditions on code that
should only be used when the compiler supports it.
Release Notes
-
1.0.0 (2020-01-08)
- 🎉 Release 1.0! 🎉 (no breaking changes)
- Add
probe_expression
andemit_expression_cfg
to test arbitrary expressions. - Add
probe_constant
andemit_constant_cfg
to test arbitrary constant expressions.
-
0.1.7 (2019-10-20)
- Apply
RUSTFLAGS
when probing$TARGET != $HOST
, mainly for sysroot, by @roblabla.
- Apply
-
0.1.6 (2019-08-19)
- Add
probe
/emit_sysroot_crate
, by @leo60228.
- Add
-
0.1.5 (2019-07-16)
- Mask some warnings from newer rustc.
-
0.1.4 (2019-05-22)
- Relax
std
/no_std
probing to a warning instead of an error. - Improve
rustc
bootstrap compatibility.
- Relax
-
0.1.3 (2019-05-21)
- Auto-detects if
#![no_std]
is needed for the$TARGET
.
- Auto-detects if
-
0.1.2 (2019-01-16)
- Add
rerun_env(ENV)
to printcargo:rerun-if-env-changed=ENV
. - Add
rerun_path(PATH)
to printcargo:rerun-if-changed=PATH
.
- Add
Minimum Rust version policy
This crate's minimum supported rustc
version is 1.0.0
. Compatibility is
its entire reason for existence, so this crate will be extremely conservative
about raising this requirement. If this is ever deemed necessary, it will be
treated as a major breaking change for semver purposes.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.