diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-04-06 14:38:05 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-04-06 14:38:05 -0700 |
commit | 88b7cd66a25ce69961940e6e2c12f616c67e08d3 (patch) | |
tree | d07cbb534236cb17000ce887a4b085d968e441ac | |
parent | 261a81c7940dbde0f09f19cc4dd10437f8d230e8 (diff) |
Clean up testing-only cargo features
This commit ensures that all of the cargo features we have that only exist for
CI/testing purposes, and aren't for external consumption, have a "testing_only_"
prefix.
-rw-r--r-- | CONTRIBUTING.md | 8 | ||||
-rw-r--r-- | Cargo.toml | 10 | ||||
-rwxr-xr-x | ci/assert-docs.sh | 2 | ||||
-rwxr-xr-x | ci/test.sh | 4 | ||||
-rw-r--r-- | src/ir/context.rs | 7 | ||||
-rw-r--r-- | src/lib.rs | 8 |
6 files changed, 22 insertions, 17 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0aad4f2c..1d78497e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,12 +65,12 @@ $ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux $ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS ``` -Additionally, you may want to build and test with the `docs_` feature to ensure -that you aren't forgetting to document types and functions. CI will catch it if -you forget, but the turn around will be a lot slower ;) +Additionally, you may want to build and test with the `testing_only_docs` +feature to ensure that you aren't forgetting to document types and functions. CI +will catch it if you forget, but the turn around will be a lot slower ;) ``` -$ cargo build --features docs_ +$ cargo build --features testing_only_docs ``` ## Testing @@ -64,10 +64,12 @@ features = ["with-syntex"] version = "0.29" [features] -assert_no_dangling_items = [] default = ["logging"] -testing_only_llvm_stable = [] logging = ["env_logger", "log"] static = [] -# This feature only exists for CI -- don't use it! -docs_ = [] + +# These features only exist for CI testing -- don't use them if you're not hacking +# on bindgen! +testing_only_assert_no_dangling_items = [] +testing_only_docs = [] +testing_only_llvm_stable = [] diff --git a/ci/assert-docs.sh b/ci/assert-docs.sh index aa4b90ac..d5757403 100755 --- a/ci/assert-docs.sh +++ b/ci/assert-docs.sh @@ -3,4 +3,4 @@ set -xeu cd "$(dirname "$0")/.." -cargo build --features "$BINDGEN_FEATURES docs_" +cargo build --features "$BINDGEN_FEATURES testing_only_docs" @@ -6,10 +6,10 @@ cd "$(dirname "$0")/.." # Regenerate the test headers' bindings in debug and release modes, and assert # that we always get the expected generated bindings. -cargo test --features "$BINDGEN_FEATURES assert_no_dangling_items" +cargo test --features "$BINDGEN_FEATURES testing_only_assert_no_dangling_items" ./ci/assert-no-diff.sh -cargo test --release --features "$BINDGEN_FEATURES assert_no_dangling_items" +cargo test --release --features "$BINDGEN_FEATURES testing_only_assert_no_dangling_items" ./ci/assert-no-diff.sh # Now test the expectations' size and alignment tests. diff --git a/src/ir/context.rs b/src/ir/context.rs index 32ee5bd0..9ff5a330 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -584,9 +584,12 @@ impl<'ctx> BindgenContext<'ctx> { ret } - /// This function trying to find any dangling references inside of `items` + /// When the `testing_only_assert_no_dangling_items` feature is enabled, + /// this function walks the IR graph and asserts that we do not have any + /// edges referencing an ItemId for which we do not have an associated IR + /// item. fn assert_no_dangling_references(&self) { - if cfg!(feature = "assert_no_dangling_items") { + if cfg!(feature = "testing_only_assert_no_dangling_items") { for _ in self.assert_no_dangling_item_traversal() { // The iterator's next method does the asserting for us. } @@ -38,15 +38,15 @@ extern crate log; mod log_stubs; // A macro to declare an internal module for which we *must* provide -// documentation for. If we are building with the "docs_" feature, then the -// module is declared public, and our `#![deny(missing_docs)]` pragma applies to -// it. This feature is used in CI, so we won't let anything slip by +// documentation for. If we are building with the "testing_only_docs" feature, +// then the module is declared public, and our `#![deny(missing_docs)]` pragma +// applies to it. This feature is used in CI, so we won't let anything slip by // undocumented. Normal builds, however, will leave the module private, so that // we don't expose internals to library consumers. macro_rules! doc_mod { ($m:ident, $doc_mod_name:ident) => { cfg_if! { - if #[cfg(feature = "docs_")] { + if #[cfg(feature = "testing_only_docs")] { pub mod $doc_mod_name { //! Autogenerated documentation module. pub use super::$m::*; |