Repository navigation
Tags
Tags
Emit private byte-blob fields for C++ field types with elided lifetimes
Until b/576904034 lands and rs_bindings_from_cc infers or threads lifetime parameters for struct and union fields whose Rust representation carries a lifetime (such as unannotated absl::Span<T>), emitting a public field with an elided '_ lifetime produces invalid Rust code (E0106: missing lifetime specifier).
Reject field types that contain an unbound elided lifetime in field_rs_type_kind_for_layout (RsTypeKind::has_elided_lifetime) so that generate_struct_and_union falls back to emitting a private [MaybeUninit<u8>; N] blob field with a doc comment explaining how to annotate the struct with $lifetime_params("a") and the field type with $a (or $static). Also omit redundant __marker_<lt> PhantomData fields on structs when a bound field already uses that lifetime parameter so that aggregate struct construction remains available.
PiperOrigin-RevId: 1021844983