Skip to content

fix(sys): update bindgen to 0.72 for libclang 22 compatibility - #416

Open
clydegerber wants to merge 1 commit into
google:mainfrom
clydegerber:fix/bindgen-libclang-22
Open

clydegerber wants to merge 1 commit into
google:mainfrom
clydegerber:fix/bindgen-libclang-22

Conversation

@clydegerber

Copy link
Copy Markdown
Contributor

Problem

With libclang 22, bindgen 0.69.5 emits UText and UCharIterator as opaque placeholders (pub _address: u8, size 1) instead of their real definitions. GitHub's ubuntu-26.04 runner image installs clang 20, 21 and 22, and clang-sys loads the newest, so test-static-linking (ubuntu-latest) fails once a repo is moved to that image:

assertion `left == right` failed: Size of: UText
  left: 1
 right: 144

google/rust_icu's runs are still landing on ubuntu-24.04, so CI here is green for now. The same commit already fails on a fork that was moved to 26.04 (run).

Change

  • rust_icu_sys: bindgen 0.69.5 → 0.72 (resolves to 0.72.1)
  • Cargo.lock and MODULE.bazel.lock refreshed. The Bazel build doesn't run bindgen, so for Bazel only the lockfile changes.

bindgen 0.70+ checks layouts at compile time, so the bindgen_test_layout_* runtime tests in rust_icu_sys are no longer generated.

Testing

  • ubuntu:26.04 container (ICU 78.2, libclang 22): reproduced the failure with 0.69.5; with 0.72.1 cargo test passes for the whole workspace (226 passed, 0 failed) and UText is generated with all its fields.
  • macOS (ICU 77.1, Apple clang 21): cargo test passes for the whole workspace (226 passed, 0 failed).

This commit was created by an automated coding assistant, with human supervision.

🤖 Generated with Claude Code

With libclang 22, bindgen 0.69.5 emits `UText` and `UCharIterator` as
opaque one-byte placeholders instead of their real definitions, so the
generated bindings have the wrong layout. GitHub's ubuntu-26.04 runner
image ships libclang 22, which breaks the `test-static-linking` job.

bindgen 0.72 generates both structs correctly. It also turns the layout
checks into compile-time assertions, so the `bindgen_test_layout_*`
runtime tests are no longer emitted.

This commit was created by an automated coding assistant, with human
supervision.
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.

1 participant