Skip to content

[CHERYPICK FIPS 4.0] Make rustfmt optional for Rust bindings generation (#3270) - #3272

Merged
justsmth merged 1 commit into
aws:fips-2025-09-12-ltsfrom
justsmth:fips-2025-09-12-lts-optional-rustfmt
May 27, 2026
Merged

justsmth merged 1 commit into
aws:fips-2025-09-12-ltsfrom
justsmth:fips-2025-09-12-lts-optional-rustfmt

Conversation

@justsmth

Copy link
Copy Markdown
Contributor

Cherrypick of #3270 onto fips-2025-09-12-lts.


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.

### 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-commenter

Copy link
Copy Markdown

Codecov Report

โœ… All modified and coverable lines are covered by tests.
โœ… Project coverage is 78.76%. Comparing base (7da5ad9) to head (e0d4b22).

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.
๐Ÿ“ข Have feedback on the report? Share it here.

๐Ÿš€ New features to boost your workflow:
  • โ„๏ธ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth
justsmth merged commit 9f04eaf into aws:fips-2025-09-12-lts May 27, 2026
158 of 192 checks passed
@justsmth
justsmth deleted the fips-2025-09-12-lts-optional-rustfmt branch May 27, 2026 17:27

This branch was successfully deployed

No deployments
auto-approve โ€” e0d4b228 Deployed May 27, 2026 by justsmth via android-fips-release-static #1181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants