Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: rust_is_available: remove warning for `bindgen` 0.66.[01]

It is not possible anymore to fall into the issue that this warning was
alerting about given the `bindgen` version bump.

Thus simplify by removing the machinery behind it, including tests.

Reviewed-by: Tamir Duberstein <tamird@kernel.org>
Link: https://patch.msgid.link/20260405235309.418950-19-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+3 -38
-13
scripts/rust_is_available.sh
··· 163 163 echo >&2 "***" 164 164 exit 1 165 165 fi 166 - if [ "$rust_bindings_generator_cversion" -eq 6600 ] || 167 - [ "$rust_bindings_generator_cversion" -eq 6601 ]; then 168 - # Distributions may have patched the issue (e.g. Debian did). 169 - if ! "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_0_66.h >/dev/null; then 170 - echo >&2 "***" 171 - echo >&2 "*** Rust bindings generator '$BINDGEN' versions 0.66.0 and 0.66.1 may not" 172 - echo >&2 "*** work due to a bug (https://github.com/rust-lang/rust-bindgen/pull/2567)," 173 - echo >&2 "*** unless patched (like Debian's)." 174 - echo >&2 "*** Your version: $rust_bindings_generator_version" 175 - echo >&2 "***" 176 - warning=1 177 - fi 178 - fi 179 166 180 167 # Check that the `libclang` used by the Rust bindings generator is suitable. 181 168 #
-2
scripts/rust_is_available_bindgen_0_66.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #define A "\0"
+3 -23
scripts/rust_is_available_test.py
··· 54 54 """) 55 55 56 56 @classmethod 57 - def generate_bindgen(cls, version_stdout, libclang_stderr, version_0_66_patched=False, libclang_concat_patched=False): 57 + def generate_bindgen(cls, version_stdout, libclang_stderr, libclang_concat_patched=False): 58 58 if libclang_stderr is None: 59 59 libclang_case = f"raise SystemExit({cls.bindgen_default_bindgen_libclang_failure_exit_code})" 60 60 else: 61 61 libclang_case = f"print({repr(libclang_stderr)}, file=sys.stderr)" 62 - 63 - if version_0_66_patched: 64 - version_0_66_case = "pass" 65 - else: 66 - version_0_66_case = "raise SystemExit(1)" 67 62 68 63 if libclang_concat_patched: 69 64 libclang_concat_case = "print('pub static mut foofoo: ::std::os::raw::c_int;')" ··· 69 74 import sys 70 75 if "rust_is_available_bindgen_libclang.h" in " ".join(sys.argv): 71 76 {libclang_case} 72 - elif "rust_is_available_bindgen_0_66.h" in " ".join(sys.argv): 73 - {version_0_66_case} 74 77 elif "rust_is_available_bindgen_libclang_concat.h" in " ".join(sys.argv): 75 78 {libclang_concat_case} 76 79 else: ··· 76 83 """) 77 84 78 85 @classmethod 79 - def generate_bindgen_version(cls, stdout, version_0_66_patched=False): 80 - return cls.generate_bindgen(stdout, cls.bindgen_default_bindgen_libclang_stderr, version_0_66_patched) 86 + def generate_bindgen_version(cls, stdout): 87 + return cls.generate_bindgen(stdout, cls.bindgen_default_bindgen_libclang_stderr) 81 88 82 89 @classmethod 83 90 def generate_bindgen_libclang_failure(cls): ··· 237 244 bindgen = self.generate_bindgen_version("bindgen 0.50.0") 238 245 result = self.run_script(self.Expected.FAILURE, { "BINDGEN": bindgen }) 239 246 self.assertIn(f"Rust bindings generator '{bindgen}' is too old.", result.stderr) 240 - 241 - def test_bindgen_bad_version_0_66_0_and_0_66_1(self): 242 - for version in ("0.66.0", "0.66.1"): 243 - with self.subTest(version=version): 244 - bindgen = self.generate_bindgen_version(f"bindgen {version}") 245 - result = self.run_script(self.Expected.SUCCESS_WITH_WARNINGS, { "BINDGEN": bindgen }) 246 - self.assertIn(f"Rust bindings generator '{bindgen}' versions 0.66.0 and 0.66.1 may not", result.stderr) 247 - 248 - def test_bindgen_bad_version_0_66_0_and_0_66_1_patched(self): 249 - for version in ("0.66.0", "0.66.1"): 250 - with self.subTest(version=version): 251 - bindgen = self.generate_bindgen_version(f"bindgen {version}", True) 252 - result = self.run_script(self.Expected.SUCCESS, { "BINDGEN": bindgen }) 253 247 254 248 def test_bindgen_libclang_failure(self): 255 249 bindgen = self.generate_bindgen_libclang_failure()