Repository navigation
[CHERYPICK FIPS 4.0] Make rustfmt optional for Rust bindings generation (#3270) - #3272
Merged
justsmth merged 1 commit intoMay 27, 2026
Conversation
### Description of changes: Configuring with `-DGENERATE_RUST_BINDINGS=ON` currently hard-fails if `rustfmt` isn't on `PATH`. This PR makes `rustfmt` optional: we still probe for it, but only pass `--formatter rustfmt` to bindgen when it's found. When it isn't, bindgen falls back to its built-in `prettyplease` formatter and the build proceeds. ### Call-outs: `prettyplease` and `rustfmt` produce slightly different output, so bindings generated on a machine without `rustfmt` will have cosmetic differences from ones generated in an environment where `rustfmt` is available. ### Testing: Existing CI exercises the `rustfmt`-present path. Locally verified that `cmake -DGENERATE_RUST_BINDINGS=ON ...` configures and the bindings target builds both with `rustfmt` on `PATH` and with it removed. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
Codecov Reportโ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fips-2025-09-12-lts #3272 +/- ##
=======================================================
- Coverage 79.02% 78.76% -0.27%
=======================================================
Files 667 667
Lines 113412 113411 -1
Branches 16106 16102 -4
=======================================================
- Hits 89628 89328 -300
- Misses 22990 23289 +299
Partials 794 794 โ View full report in Codecov by Sentry. ๐ New features to boost your workflow:
|
samuel40791765
approved these changes
May 27, 2026
crlorentzen
approved these changes
May 27, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherrypick of #3270 onto
fips-2025-09-12-lts.Description of changes:
Configuring with
-DGENERATE_RUST_BINDINGS=ONcurrently hard-fails ifrustfmtisn't onPATH. This PR makesrustfmtoptional: we still probe for it, but only pass--formatter rustfmtto bindgen when it's found. When it isn't, bindgen falls back to its built-inprettypleaseformatter and the build proceeds.Call-outs:
prettypleaseandrustfmtproduce slightly different output, so bindings generated on a machine withoutrustfmtwill have cosmetic differences from ones generated in an environment whererustfmtis available.Testing:
Existing CI exercises the
rustfmt-present path. Locally verified thatcmake -DGENERATE_RUST_BINDINGS=ON ...configures and the bindings target builds both withrustfmtonPATHand with it removed.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.