From 01036135bd52a7729f562a0f3de82c6b6e8807d0 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 9 Mar 2026 10:31:11 -0700 Subject: [PATCH] Disable bindings for trait implementations that use isize/usize See b/491106325 for full context, but these traits cause coherence issues in C++ because they alias different primitives based on platform. PiperOrigin-RevId: 880925620 --- bazel/llvm.bzl | 2 +- cc_bindings_from_rs/generate_bindings/lib.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bazel/llvm.bzl b/bazel/llvm.bzl index ce48adf5d..6da829f79 100644 --- a/bazel/llvm.bzl +++ b/bazel/llvm.bzl @@ -53,7 +53,7 @@ def _llvm_loader_repository(repository_ctx): executable = False, ) -LLVM_COMMIT_SHA = "5f1683ca1a4a582a73eabd79cad46a5294b35c33" +LLVM_COMMIT_SHA = "d8474abfc1e7c3856b85b088f1133ae2e90da3d0" def llvm_loader_repository_dependencies(): # This *declares* the dependency, but it won't actually be *downloaded* unless it's used. diff --git a/cc_bindings_from_rs/generate_bindings/lib.rs b/cc_bindings_from_rs/generate_bindings/lib.rs index 1a8812802..3ed59c8d4 100644 --- a/cc_bindings_from_rs/generate_bindings/lib.rs +++ b/cc_bindings_from_rs/generate_bindings/lib.rs @@ -1705,6 +1705,14 @@ fn generate_trait_impls<'a, 'tcx>( if arg.flags().contains(has_type_or_const_vars()) { return Err((impl_def_id, anyhow!("Implementation of traits must specify all types to receive bindings."))); } + if arg.walk().any(|arg| arg.as_type().is_some_and(|ty| ty.is_ptr_sized_integral())) { + return Err(( + impl_def_id, + anyhow!( + "b/491106325 - isize and usize types are not yet supported as trait type arguments." + ), + )); + } db.format_ty_for_cc(arg, TypeLocation::Other) .map(|snippet| snippet.into_tokens(&mut prereqs)) .map_err(|err| (impl_def_id, err))