Stop using double underscores for our C function names and standardize on the 'rust_proto_' prefix.

Besides unnecessary inconsistency on our C symbols, double underscores anywhere in the name are reserved for stdlib use.  In practice its unlikely these symbols would ever hit a collision problem (maybe the prior name 'utf8_debug_string' with no prefix as having some risk), but safer to just standardize on this and have no concerns going forward.

PiperOrigin-RevId: 648709299
pull/17275/head
Protobuf Team Bot 9 months ago committed by Copybara-Service
parent dba1aa1c81
commit a9bc366522
  1. 66
      rust/cpp.rs
  2. 4
      rust/cpp_kernel/debug.cc
  3. 4
      rust/cpp_kernel/debug.h
  4. 2
      rust/cpp_kernel/map.cc
  5. 18
      rust/cpp_kernel/map.h
  6. 104
      rust/cpp_kernel/repeated.cc
  7. 2
      rust/cpp_kernel/rust_alloc_for_cpp_api.h
  8. 2
      rust/cpp_kernel/rust_alloc_for_cpp_api.rs
  9. 2
      rust/cpp_kernel/serialized_data.h
  10. 2
      rust/cpp_kernel/strings.cc
  11. 10
      src/google/protobuf/compiler/rust/naming.cc

@ -261,17 +261,17 @@ impl From<RustStringRawParts> for String {
}
extern "C" {
fn utf8_debug_string(msg: RawMessage) -> RustStringRawParts;
fn utf8_debug_string_lite(msg: RawMessage) -> RustStringRawParts;
fn rust_proto_utf8_debug_string(msg: RawMessage) -> RustStringRawParts;
fn rust_proto_utf8_debug_string_lite(msg: RawMessage) -> RustStringRawParts;
}
pub fn debug_string(_private: Private, msg: RawMessage, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// SAFETY:
// - `msg` is a valid protobuf message.
#[cfg(not(lite_runtime))]
let dbg_str: String = unsafe { utf8_debug_string(msg) }.into();
let dbg_str: String = unsafe { rust_proto_utf8_debug_string(msg) }.into();
#[cfg(lite_runtime)]
let dbg_str: String = unsafe { utf8_debug_string_lite(msg) }.into();
let dbg_str: String = unsafe { rust_proto_utf8_debug_string_lite(msg) }.into();
write!(f, "{dbg_str}")
}
@ -485,15 +485,15 @@ macro_rules! impl_repeated_primitives {
paste!{
impl_repeated_primitives!(@impl $(
$t => [
[< __pb_rust_RepeatedField_ $t _new >],
[< __pb_rust_RepeatedField_ $t _free >],
[< __pb_rust_RepeatedField_ $t _add >],
[< __pb_rust_RepeatedField_ $t _size >],
[< __pb_rust_RepeatedField_ $t _get >],
[< __pb_rust_RepeatedField_ $t _set >],
[< __pb_rust_RepeatedField_ $t _clear >],
[< __pb_rust_RepeatedField_ $t _copy_from >],
[< __pb_rust_RepeatedField_ $t _reserve >],
[< rust_proto_RepeatedField_ $t _new >],
[< rust_proto_RepeatedField_ $t _free >],
[< rust_proto_RepeatedField_ $t _add >],
[< rust_proto_RepeatedField_ $t _size >],
[< rust_proto_RepeatedField_ $t _get >],
[< rust_proto_RepeatedField_ $t _set >],
[< rust_proto_RepeatedField_ $t _clear >],
[< rust_proto_RepeatedField_ $t _copy_from >],
[< rust_proto_RepeatedField_ $t _reserve >],
],
)*);
}
@ -644,7 +644,7 @@ impl UntypedMapIterator {
// - Standard layout.
// - The size and alignment of the Rust type above.
// - With the `node_` field first.
unsafe { __rust_proto_thunk__UntypedMapIterator_increment(self) }
unsafe { rust_proto_thunk_UntypedMapIterator_increment(self) }
// SAFETY:
// - The `get` function always writes valid values to `ffi_key` and `ffi_value`
@ -656,22 +656,22 @@ impl UntypedMapIterator {
}
extern "C" {
fn __rust_proto_thunk__UntypedMapIterator_increment(iter: &mut UntypedMapIterator);
fn rust_proto_thunk_UntypedMapIterator_increment(iter: &mut UntypedMapIterator);
}
macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types {
($key_t:ty, $ffi_key_t:ty, $to_ffi_key:expr, $from_ffi_key:expr, for $($t:ty, $ffi_t:ty, $to_ffi_value:expr, $from_ffi_value:expr;)*) => {
paste! { $(
extern "C" {
fn [< __rust_proto_thunk__Map_ $key_t _ $t _new >]() -> RawMap;
fn [< __rust_proto_thunk__Map_ $key_t _ $t _free >](m: RawMap);
fn [< __rust_proto_thunk__Map_ $key_t _ $t _clear >](m: RawMap);
fn [< __rust_proto_thunk__Map_ $key_t _ $t _size >](m: RawMap) -> usize;
fn [< __rust_proto_thunk__Map_ $key_t _ $t _insert >](m: RawMap, key: $ffi_key_t, value: $ffi_t) -> bool;
fn [< __rust_proto_thunk__Map_ $key_t _ $t _get >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_t) -> bool;
fn [< __rust_proto_thunk__Map_ $key_t _ $t _iter >](m: RawMap) -> UntypedMapIterator;
fn [< __rust_proto_thunk__Map_ $key_t _ $t _iter_get >](iter: &mut UntypedMapIterator, key: *mut $ffi_key_t, value: *mut $ffi_t);
fn [< __rust_proto_thunk__Map_ $key_t _ $t _remove >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_t) -> bool;
fn [< rust_proto_thunk_Map_ $key_t _ $t _new >]() -> RawMap;
fn [< rust_proto_thunk_Map_ $key_t _ $t _free >](m: RawMap);
fn [< rust_proto_thunk_Map_ $key_t _ $t _clear >](m: RawMap);
fn [< rust_proto_thunk_Map_ $key_t _ $t _size >](m: RawMap) -> usize;
fn [< rust_proto_thunk_Map_ $key_t _ $t _insert >](m: RawMap, key: $ffi_key_t, value: $ffi_t) -> bool;
fn [< rust_proto_thunk_Map_ $key_t _ $t _get >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_t) -> bool;
fn [< rust_proto_thunk_Map_ $key_t _ $t _iter >](m: RawMap) -> UntypedMapIterator;
fn [< rust_proto_thunk_Map_ $key_t _ $t _iter_get >](iter: &mut UntypedMapIterator, key: *mut $ffi_key_t, value: *mut $ffi_t);
fn [< rust_proto_thunk_Map_ $key_t _ $t _remove >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_t) -> bool;
}
impl ProxiedInMapValue<$key_t> for $t {
@ -680,7 +680,7 @@ macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types {
Map::from_inner(
Private,
InnerMap {
raw: [< __rust_proto_thunk__Map_ $key_t _ $t _new >](),
raw: [< rust_proto_thunk_Map_ $key_t _ $t _new >](),
}
)
}
@ -690,28 +690,28 @@ macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types {
// SAFETY:
// - `map.inner.raw` is a live `RawMap`
// - This function is only called once for `map` in `Drop`.
unsafe { [< __rust_proto_thunk__Map_ $key_t _ $t _free >](map.as_mut().as_raw(Private)); }
unsafe { [< rust_proto_thunk_Map_ $key_t _ $t _free >](map.as_mut().as_raw(Private)); }
}
fn map_clear(mut map: Mut<'_, Map<$key_t, Self>>) {
unsafe { [< __rust_proto_thunk__Map_ $key_t _ $t _clear >](map.as_raw(Private)); }
unsafe { [< rust_proto_thunk_Map_ $key_t _ $t _clear >](map.as_raw(Private)); }
}
fn map_len(map: View<'_, Map<$key_t, Self>>) -> usize {
unsafe { [< __rust_proto_thunk__Map_ $key_t _ $t _size >](map.as_raw(Private)) }
unsafe { [< rust_proto_thunk_Map_ $key_t _ $t _size >](map.as_raw(Private)) }
}
fn map_insert(mut map: Mut<'_, Map<$key_t, Self>>, key: View<'_, $key_t>, value: View<'_, Self>) -> bool {
let ffi_key = $to_ffi_key(key);
let ffi_value = $to_ffi_value(value);
unsafe { [< __rust_proto_thunk__Map_ $key_t _ $t _insert >](map.as_raw(Private), ffi_key, ffi_value) }
unsafe { [< rust_proto_thunk_Map_ $key_t _ $t _insert >](map.as_raw(Private), ffi_key, ffi_value) }
}
fn map_get<'a>(map: View<'a, Map<$key_t, Self>>, key: View<'_, $key_t>) -> Option<View<'a, Self>> {
let ffi_key = $to_ffi_key(key);
let mut ffi_value = MaybeUninit::uninit();
let found = unsafe { [< __rust_proto_thunk__Map_ $key_t _ $t _get >](map.as_raw(Private), ffi_key, ffi_value.as_mut_ptr()) };
let found = unsafe { [< rust_proto_thunk_Map_ $key_t _ $t _get >](map.as_raw(Private), ffi_key, ffi_value.as_mut_ptr()) };
if !found {
return None;
@ -723,7 +723,7 @@ macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types {
fn map_remove(mut map: Mut<'_, Map<$key_t, Self>>, key: View<'_, $key_t>) -> bool {
let ffi_key = $to_ffi_key(key);
let mut ffi_value = MaybeUninit::uninit();
unsafe { [< __rust_proto_thunk__Map_ $key_t _ $t _remove >](map.as_raw(Private), ffi_key, ffi_value.as_mut_ptr()) }
unsafe { [< rust_proto_thunk_Map_ $key_t _ $t _remove >](map.as_raw(Private), ffi_key, ffi_value.as_mut_ptr()) }
}
fn map_iter(map: View<'_, Map<$key_t, Self>>) -> MapIter<'_, $key_t, Self> {
@ -735,7 +735,7 @@ macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types {
unsafe {
MapIter::from_raw(
Private,
[< __rust_proto_thunk__Map_ $key_t _ $t _iter >](map.as_raw(Private))
[< rust_proto_thunk_Map_ $key_t _ $t _iter >](map.as_raw(Private))
)
}
}
@ -750,7 +750,7 @@ macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types {
unsafe {
iter.as_raw_mut(Private).next_unchecked::<$key_t, Self, _, _>(
Private,
[< __rust_proto_thunk__Map_ $key_t _ $t _iter_get >],
[< rust_proto_thunk_Map_ $key_t _ $t _iter_get >],
$from_ffi_key,
$from_ffi_value,
)

@ -8,13 +8,13 @@
extern "C" {
google::protobuf::rust_internal::RustStringRawParts utf8_debug_string(
google::protobuf::rust_internal::RustStringRawParts rust_proto_utf8_debug_string(
const google::protobuf::Message* msg) {
std::string text = google::protobuf::Utf8Format(*msg);
return google::protobuf::rust_internal::RustStringRawParts(text);
}
google::protobuf::rust_internal::RustStringRawParts utf8_debug_string_lite(
google::protobuf::rust_internal::RustStringRawParts rust_proto_utf8_debug_string_lite(
const google::protobuf::MessageLite* msg) {
std::string text = google::protobuf::Utf8Format(*msg);
return google::protobuf::rust_internal::RustStringRawParts(text);

@ -7,10 +7,10 @@
extern "C" {
google::protobuf::rust_internal::RustStringRawParts utf8_debug_string(
google::protobuf::rust_internal::RustStringRawParts rust_proto_utf8_debug_string(
const google::protobuf::Message* msg);
google::protobuf::rust_internal::RustStringRawParts utf8_debug_string_lite(
google::protobuf::rust_internal::RustStringRawParts rust_proto_utf8_debug_string_lite(
const google::protobuf::MessageLite* msg);
} // extern "C"

@ -8,7 +8,7 @@
extern "C" {
void __rust_proto_thunk__UntypedMapIterator_increment(
void rust_proto_thunk_UntypedMapIterator_increment(
google::protobuf::internal::UntypedMapIterator* iter) {
iter->PlusPlus();
}

@ -6,22 +6,22 @@
key_ty, rust_key_ty, ffi_key_ty, to_cpp_key, to_ffi_key, value_ty, \
rust_value_ty, ffi_value_ty, to_cpp_value, to_ffi_value) \
google::protobuf::Map<key_ty, value_ty>* \
__rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_new() { \
rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_new() { \
return new google::protobuf::Map<key_ty, value_ty>(); \
} \
void __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_free( \
void rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_free( \
google::protobuf::Map<key_ty, value_ty>* m) { \
delete m; \
} \
void __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_clear( \
void rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_clear( \
google::protobuf::Map<key_ty, value_ty>* m) { \
m->clear(); \
} \
size_t __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_size( \
size_t rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_size( \
const google::protobuf::Map<key_ty, value_ty>* m) { \
return m->size(); \
} \
bool __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_insert( \
bool rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_insert( \
google::protobuf::Map<key_ty, value_ty>* m, ffi_key_ty key, ffi_value_ty value) { \
auto iter_and_inserted = m->try_emplace(to_cpp_key, to_cpp_value); \
if (!iter_and_inserted.second) { \
@ -29,7 +29,7 @@
} \
return iter_and_inserted.second; \
} \
bool __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_get( \
bool rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_get( \
const google::protobuf::Map<key_ty, value_ty>* m, ffi_key_ty key, \
ffi_value_ty* value) { \
auto cpp_key = to_cpp_key; \
@ -42,11 +42,11 @@
return true; \
} \
google::protobuf::internal::UntypedMapIterator \
__rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_iter( \
rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_iter( \
const google::protobuf::Map<key_ty, value_ty>* m) { \
return google::protobuf::internal::UntypedMapIterator::FromTyped(m->cbegin()); \
} \
void __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_iter_get( \
void rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_iter_get( \
const google::protobuf::internal::UntypedMapIterator* iter, ffi_key_ty* key, \
ffi_value_ty* value) { \
auto typed_iter = \
@ -56,7 +56,7 @@
*key = to_ffi_key; \
*value = to_ffi_value; \
} \
bool __rust_proto_thunk__Map_##rust_key_ty##_##rust_value_ty##_remove( \
bool rust_proto_thunk_Map_##rust_key_ty##_##rust_value_ty##_remove( \
google::protobuf::Map<key_ty, value_ty>* m, ffi_key_ty key, ffi_value_ty* value) { \
auto cpp_key = to_cpp_key; \
auto num_removed = m->erase(cpp_key); \

@ -11,38 +11,38 @@
extern "C" {
#define expose_repeated_field_methods(ty, rust_ty) \
google::protobuf::RepeatedField<ty>* __pb_rust_RepeatedField_##rust_ty##_new() { \
google::protobuf::RepeatedField<ty>* rust_proto_RepeatedField_##rust_ty##_new() { \
return new google::protobuf::RepeatedField<ty>(); \
} \
void __pb_rust_RepeatedField_##rust_ty##_free( \
void rust_proto_RepeatedField_##rust_ty##_free( \
google::protobuf::RepeatedField<ty>* r) { \
delete r; \
} \
void __pb_rust_RepeatedField_##rust_ty##_add(google::protobuf::RepeatedField<ty>* r, \
ty val) { \
void rust_proto_RepeatedField_##rust_ty##_add(google::protobuf::RepeatedField<ty>* r, \
ty val) { \
r->Add(val); \
} \
size_t __pb_rust_RepeatedField_##rust_ty##_size( \
size_t rust_proto_RepeatedField_##rust_ty##_size( \
google::protobuf::RepeatedField<ty>* r) { \
return r->size(); \
} \
ty __pb_rust_RepeatedField_##rust_ty##_get(google::protobuf::RepeatedField<ty>* r, \
size_t index) { \
ty rust_proto_RepeatedField_##rust_ty##_get(google::protobuf::RepeatedField<ty>* r, \
size_t index) { \
return r->Get(index); \
} \
void __pb_rust_RepeatedField_##rust_ty##_set(google::protobuf::RepeatedField<ty>* r, \
size_t index, ty val) { \
void rust_proto_RepeatedField_##rust_ty##_set(google::protobuf::RepeatedField<ty>* r, \
size_t index, ty val) { \
return r->Set(index, val); \
} \
void __pb_rust_RepeatedField_##rust_ty##_copy_from( \
void rust_proto_RepeatedField_##rust_ty##_copy_from( \
const google::protobuf::RepeatedField<ty>* src, google::protobuf::RepeatedField<ty>* dst) { \
dst->CopyFrom(*src); \
} \
void __pb_rust_RepeatedField_##rust_ty##_clear( \
void rust_proto_RepeatedField_##rust_ty##_clear( \
google::protobuf::RepeatedField<ty>* r) { \
r->Clear(); \
} \
void __pb_rust_RepeatedField_##rust_ty##_reserve( \
void rust_proto_RepeatedField_##rust_ty##_reserve( \
google::protobuf::RepeatedField<ty>* r, size_t additional) { \
r->Reserve(r->size() + additional); \
}
@ -56,46 +56,46 @@ expose_repeated_field_methods(uint64_t, u64);
expose_repeated_field_methods(int64_t, i64);
#undef expose_repeated_field_methods
#define expose_repeated_ptr_field_methods(ty) \
google::protobuf::RepeatedPtrField<std::string>* \
__pb_rust_RepeatedField_##ty##_new() { \
return new google::protobuf::RepeatedPtrField<std::string>(); \
} \
void __pb_rust_RepeatedField_##ty##_free( \
google::protobuf::RepeatedPtrField<std::string>* r) { \
delete r; \
} \
void __pb_rust_RepeatedField_##ty##_add( \
google::protobuf::RepeatedPtrField<std::string>* r, \
google::protobuf::rust_internal::PtrAndLen val) { \
r->Add(std::string(val.ptr, val.len)); \
} \
size_t __pb_rust_RepeatedField_##ty##_size( \
google::protobuf::RepeatedPtrField<std::string>* r) { \
return r->size(); \
} \
google::protobuf::rust_internal::PtrAndLen __pb_rust_RepeatedField_##ty##_get( \
google::protobuf::RepeatedPtrField<std::string>* r, size_t index) { \
const std::string& s = r->Get(index); \
return google::protobuf::rust_internal::PtrAndLen(s.data(), s.size()); \
} \
void __pb_rust_RepeatedField_##ty##_set( \
google::protobuf::RepeatedPtrField<std::string>* r, size_t index, \
google::protobuf::rust_internal::PtrAndLen val) { \
*r->Mutable(index) = std::string(val.ptr, val.len); \
} \
void __pb_rust_RepeatedField_##ty##_copy_from( \
const google::protobuf::RepeatedPtrField<std::string>* src, \
google::protobuf::RepeatedPtrField<std::string>* dst) { \
dst->CopyFrom(*src); \
} \
void __pb_rust_RepeatedField_##ty##_clear( \
google::protobuf::RepeatedPtrField<std::string>* r) { \
r->Clear(); \
} \
void __pb_rust_RepeatedField_##ty##_reserve( \
google::protobuf::RepeatedPtrField<std::string>* r, size_t additional) { \
r->Reserve(r->size() + additional); \
#define expose_repeated_ptr_field_methods(ty) \
google::protobuf::RepeatedPtrField<std::string>* \
rust_proto_RepeatedField_##ty##_new() { \
return new google::protobuf::RepeatedPtrField<std::string>(); \
} \
void rust_proto_RepeatedField_##ty##_free( \
google::protobuf::RepeatedPtrField<std::string>* r) { \
delete r; \
} \
void rust_proto_RepeatedField_##ty##_add( \
google::protobuf::RepeatedPtrField<std::string>* r, \
google::protobuf::rust_internal::PtrAndLen val) { \
r->Add(std::string(val.ptr, val.len)); \
} \
size_t rust_proto_RepeatedField_##ty##_size( \
google::protobuf::RepeatedPtrField<std::string>* r) { \
return r->size(); \
} \
google::protobuf::rust_internal::PtrAndLen rust_proto_RepeatedField_##ty##_get( \
google::protobuf::RepeatedPtrField<std::string>* r, size_t index) { \
const std::string& s = r->Get(index); \
return google::protobuf::rust_internal::PtrAndLen(s.data(), s.size()); \
} \
void rust_proto_RepeatedField_##ty##_set( \
google::protobuf::RepeatedPtrField<std::string>* r, size_t index, \
google::protobuf::rust_internal::PtrAndLen val) { \
*r->Mutable(index) = std::string(val.ptr, val.len); \
} \
void rust_proto_RepeatedField_##ty##_copy_from( \
const google::protobuf::RepeatedPtrField<std::string>* src, \
google::protobuf::RepeatedPtrField<std::string>* dst) { \
dst->CopyFrom(*src); \
} \
void rust_proto_RepeatedField_##ty##_clear( \
google::protobuf::RepeatedPtrField<std::string>* r) { \
r->Clear(); \
} \
void rust_proto_RepeatedField_##ty##_reserve( \
google::protobuf::RepeatedPtrField<std::string>* r, size_t additional) { \
r->Reserve(r->size() + additional); \
}
expose_repeated_ptr_field_methods(ProtoString);

@ -6,6 +6,6 @@
// Allocates memory using the current Rust global allocator.
//
// This function is defined in `rust_alloc_for_cpp_api.rs`.
extern "C" void* __pb_rust_alloc(size_t size, size_t align);
extern "C" void* rust_proto_alloc(size_t size, size_t align);
#endif // GOOGLE_PROTOBUF_RUST_CPP_KERNEL_RUST_ALLOC_FOR_CPP_API_H__

@ -8,7 +8,7 @@
use std::alloc::{alloc, Layout};
#[no_mangle]
extern "C" fn __pb_rust_alloc(size: usize, align: usize) -> *mut u8 {
extern "C" fn rust_proto_alloc(size: usize, align: usize) -> *mut u8 {
if size == 0 {
// A 0-sized layout is legal but the global allocator isn't required to support
// it so return a dangling pointer instead.

@ -46,7 +46,7 @@ inline bool SerializeMsg(const google::protobuf::MessageLite* msg, SerializedDat
<< " exceeded maximum protobuf size of 2GB: " << len;
return false;
}
uint8_t* bytes = static_cast<uint8_t*>(__pb_rust_alloc(len, alignof(char)));
uint8_t* bytes = static_cast<uint8_t*>(rust_proto_alloc(len, alignof(char)));
if (bytes == nullptr) {
ABSL_LOG(FATAL) << "Rust allocator failed to allocate memory.";
}

@ -14,7 +14,7 @@ RustStringRawParts::RustStringRawParts(std::string src) {
data = nullptr;
len = 0;
} else {
void* d = __pb_rust_alloc(src.length(), 1);
void* d = rust_proto_alloc(src.length(), 1);
std::memcpy(d, src.data(), src.length());
data = static_cast<char*>(d);
len = src.length();

@ -65,13 +65,13 @@ std::string GetHeaderFile(Context& ctx, const FileDescriptor& file) {
std::string RawMapThunk(Context& ctx, const Descriptor& msg,
absl::string_view key_t, absl::string_view op) {
return absl::StrCat("__rust_proto_thunk__Map_", key_t, "_",
return absl::StrCat("rust_proto_thunk_Map_", key_t, "_",
GetUnderscoreDelimitedFullName(ctx, *&msg), "_", op);
}
std::string RawMapThunk(Context& ctx, const EnumDescriptor& desc,
absl::string_view key_t, absl::string_view op) {
return absl::StrCat("__rust_proto_thunk__Map_", key_t, "_",
return absl::StrCat("rust_proto_thunk_Map_", key_t, "_",
GetUnderscoreDelimitedFullName(ctx, *&desc), "_", op);
}
@ -82,7 +82,7 @@ std::string FieldPrefix(Context& ctx, const T& field) {
// NOTE: When ctx.is_upb(), this functions outputs must match the symbols
// that the upbc plugin generates exactly. Failure to do so correctly results
// in a link-time failure.
absl::string_view prefix = ctx.is_cpp() ? "__rust_proto_thunk__" : "";
absl::string_view prefix = ctx.is_cpp() ? "rust_proto_thunk_" : "";
std::string thunk_prefix = absl::StrCat(
prefix, GetUnderscoreDelimitedFullName(ctx, *field.containing_type()));
return thunk_prefix;
@ -148,7 +148,7 @@ std::string ThunkName(Context& ctx, const OneofDescriptor& field,
std::string ThunkName(Context& ctx, const Descriptor& msg,
absl::string_view op) {
absl::string_view prefix = ctx.is_cpp() ? "__rust_proto_thunk__" : "";
absl::string_view prefix = ctx.is_cpp() ? "rust_proto_thunk_" : "";
return absl::StrCat(prefix, GetUnderscoreDelimitedFullName(ctx, msg), "_",
op);
}
@ -465,3 +465,5 @@ PROTOBUF_CONSTINIT const MapKeyType kMapKeyTypes[] = {
} // namespace compiler
} // namespace protobuf
} // namespace google
#include "google/protobuf/port_undef.inc"

Loading…
Cancel
Save