diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-12-15 08:53:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-15 08:53:42 -0800 |
commit | 46b52e6e7f8c2cf62d529f38f1e0781cf3347da9 (patch) | |
tree | 6c872af0b8a1b5f659cfd5d4675a3c8c99f40cab | |
parent | 3289e9392eaad0a00bc180089a119976ad6c488f (diff) | |
parent | 15c687e0f1bec97448168f981ec93d207884a775 (diff) |
Auto merge of #345 - fitzgen:use-feature-for-dangling-item-asserts, r=emilio
Use a feature to control dangling item assertions
These checks are expensive enough that we only want to do them when hacking on
bindgen itself, not anytime someone does a debug build of something that depends
on bindgen.
r? @emilio
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | libbindgen/Cargo.toml | 1 | ||||
-rw-r--r-- | libbindgen/src/ir/context.rs | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index df1a5156..d5fb4455 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,8 +26,8 @@ before_install: . ./ci/before_install.sh before_script: cd libbindgen script: - - cargo test --features "$BINDGEN_FEATURES" - - cargo test --release --features "$BINDGEN_FEATURES" + - cargo test --features "$BINDGEN_FEATURES assert_no_dangling_items" + - cargo test --release --features "$BINDGEN_FEATURES assert_no_dangling_items" - git add -A - git diff @ - git diff-index --quiet HEAD diff --git a/libbindgen/Cargo.toml b/libbindgen/Cargo.toml index 6e6b0455..df22afdd 100644 --- a/libbindgen/Cargo.toml +++ b/libbindgen/Cargo.toml @@ -50,6 +50,7 @@ features = ["with-syntex"] version = "0.26" [features] +assert_no_dangling_items = [] default = ["logging"] llvm_stable = [] logging = ["env_logger", "log"] diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs index 4cf772dc..ba8ffe82 100644 --- a/libbindgen/src/ir/context.rs +++ b/libbindgen/src/ir/context.rs @@ -473,7 +473,7 @@ impl<'ctx> BindgenContext<'ctx> { /// This function trying to find any dangling references inside of `items` fn assert_no_dangling_references(&self) { - if cfg!(debug_assertions) { + if cfg!(feature = "assert_no_dangling_items") { for _ in self.assert_no_dangling_item_traversal() { // The iterator's next method does the asserting for us. } |