Skip to content

Commit 3aeb11d

Browse files
thunderseethecopybara-github
authored andcommitted
Avoid generating bindings to simd primitives.
These primitives overlap with C++ macros of the same name in a way that breaks generated bindings. It is unlikely we need bindings to Rust primitives in C++, so avoid the issue by excluding the bindings. PiperOrigin-RevId: 827678631
1 parent 7e88dac commit 3aeb11d

File tree

1 file changed

+7
-0
lines changed
  • cc_bindings_from_rs/generate_bindings

1 file changed

+7
-0
lines changed

cc_bindings_from_rs/generate_bindings/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ fn public_paths_by_def_id(
367367
if stability.is_unstable() {
368368
return;
369369
}
370+
// SIMD primitives often have name collisions with SIMD primitives in C++. The C++
371+
// primitives are macros, so namespacing does not prevent collision. We expect people
372+
// will not need bindings to these primitives, so we exclude them to prevent the
373+
// collission.
374+
if ["simd_arch", "simd_x86"].contains(&stability.feature.as_str()) {
375+
return;
376+
}
370377
}
371378

372379
// Map type aliases to their underlying type.

0 commit comments

Comments
 (0)