Skip to content

Commit 4bc7403

Browse files
committed
ci: Replace extra_assert by debug_assert
This basically means that running a debug build of `bindgen` will always have the extra assertions enabled, which should help us catch more bugs than having them only running on CI.
1 parent 42218df commit 4bc7403

File tree

16 files changed

+20
-62
lines changed

16 files changed

+20
-62
lines changed

.github/workflows/bindgen.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,8 @@ jobs:
136136
# FIXME: There are no pre-built static libclang libraries, so the
137137
# `static` feature is not testable atm.
138138
feature_runtime: [0, 1]
139-
feature_extra_asserts: [0]
140139

141140
include:
142-
# Test with extra asserts + docs just with latest llvm versions to
143-
# prevent explosion
144-
- os: ubuntu-latest
145-
llvm_version: "16.0"
146-
release_build: 0
147-
no_default_features: 0
148-
feature_extra_asserts: 1
149-
150141
# FIXME: Seems installing multiarch packages fails:
151142
#
152143
# https://github.com/rust-lang/rust-bindgen/pull/2037/checks?check_run_id=2441799333
@@ -159,14 +150,12 @@ jobs:
159150
# llvm_version: "16.0"
160151
# main_tests: 0
161152
# release_build: 0
162-
# feature_extra_asserts: 0
163153

164154
# Ensure stuff works on macos too
165155
- os: macos-latest
166156
llvm_version: "16.0"
167157
release_build: 0
168158
no_default_features: 0
169-
feature_extra_asserts: 0
170159
steps:
171160
- uses: actions/checkout@v4
172161

@@ -207,9 +196,8 @@ jobs:
207196
BINDGEN_MAIN_TESTS: ${{matrix.main_tests}}
208197
BINDGEN_RELEASE_BUILD: ${{matrix.release_build}}
209198
BINDGEN_FEATURE_RUNTIME: ${{matrix.feature_runtime}}
210-
BINDGEN_FEATURE_EXTRA_ASSERTS: ${{matrix.feature_extra_asserts}}
211199
BINDGEN_NO_DEFAULT_FEATURES: ${{matrix.no_default_features}}
212-
BINDGEN_RUST_FOR_LINUX_TEST: ${{matrix.os == 'ubuntu-latest' && matrix.llvm_version == '16.0' && matrix.feature_extra_asserts == 0 && 1 || 0}}
200+
BINDGEN_RUST_FOR_LINUX_TEST: ${{matrix.os == 'ubuntu-latest' && matrix.llvm_version == '16.0' && 1 || 0}}
213201
run: ./ci/test.sh
214202

215203
check-cfg:

bindgen-cli/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ prettyplease = ["bindgen/prettyplease"]
3838
## The following features are for internal use and they shouldn't be used if
3939
## you're not hacking on bindgen
4040
# Features used for CI testing
41-
__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
4241
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
4342
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]
4443

bindgen-integration/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ cc.workspace = true
1818
static = ["bindgen/static"]
1919
runtime = ["bindgen/runtime"]
2020

21-
__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
2221
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
2322
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]

bindgen-tests/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ logging = ["bindgen/logging"]
2323
static = ["bindgen/static"]
2424
runtime = ["bindgen/runtime"]
2525

26-
__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
2726
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
2827
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]

bindgen-tests/tests/stylo_sanity.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
/// how long bindings generation takes for Stylo. Stylo bindings generation
1111
/// takes too long to be a proper `#[bench]`.
1212
#[test]
13-
#[cfg(not(any(
14-
debug_assertions,
15-
feature = "__testing_only_extra_assertions",
16-
)))]
13+
#[cfg(not(any(debug_assertions, debug_assertions,)))]
1714
#[cfg(any(
1815
feature = "__testing_only_libclang_9",
1916
feature = "__testing_only_libclang_16"

bindgen/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ experimental = ["dep:annotate-snippets"]
5656
# Features used by `bindgen-cli`
5757
__cli = ["dep:clap", "dep:clap_complete"]
5858
# Features used for CI testing
59-
__testing_only_extra_assertions = []
6059
__testing_only_libclang_9 = []
6160
__testing_only_libclang_16 = []
6261

bindgen/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4446,7 +4446,7 @@ impl TryToRustTy for TemplateInstantiation {
44464446
// This can happen if we generated an opaque type for a partial
44474447
// template specialization, and we've hit an instantiation of
44484448
// that partial specialization.
4449-
extra_assert!(def.is_opaque(ctx, &()));
4449+
debug_assert!(def.is_opaque(ctx, &()));
44504450
return Err(Error::InstantiationOfOpaqueType);
44514451
}
44524452

bindgen/extra_assertions.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

bindgen/ir/analysis/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ impl<'ctx> MonotoneFramework for CannotDerive<'ctx> {
698698

699699
impl<'ctx> From<CannotDerive<'ctx>> for HashMap<ItemId, CanDerive> {
700700
fn from(analysis: CannotDerive<'ctx>) -> Self {
701-
extra_assert!(analysis
701+
debug_assert!(analysis
702702
.can_derive
703703
.values()
704704
.all(|v| *v != CanDerive::Yes));

bindgen/ir/analysis/has_vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'ctx> MonotoneFramework for HasVtableAnalysis<'ctx> {
210210
impl<'ctx> From<HasVtableAnalysis<'ctx>> for HashMap<ItemId, HasVtableResult> {
211211
fn from(analysis: HasVtableAnalysis<'ctx>) -> Self {
212212
// We let the lack of an entry mean "No" to save space.
213-
extra_assert!(analysis
213+
debug_assert!(analysis
214214
.have_vtable
215215
.values()
216216
.all(|v| { *v != HasVtableResult::No }));

0 commit comments

Comments
 (0)