Refactor std::marker::PhantomData to $phantom$

PiperOrigin-RevId: 553165873
pull/13445/head
Hong Shin 2 years ago committed by Copybara-Service
parent 7c2ed10beb
commit 6f778d8d53
  1. 1
      src/google/protobuf/compiler/rust/generator.cc
  2. 4
      src/google/protobuf/compiler/rust/message.cc

@ -238,6 +238,7 @@ bool RustGenerator::Generate(const FileDescriptor* file_desc,
{"pbi", "::__pb::__internal"},
{"pbr", "::__pb::__runtime"},
{"NonNull", "::__std::ptr::NonNull"},
{"Phantom", "::__std::marker::PhantomData"},
});
file.Emit({{"kernel", KernelRsName(file.opts().kernel)}}, R"rs(

@ -303,7 +303,7 @@ void MessageGenerator::GenerateRs(Context<Descriptor> msg) {
#[derive(Debug, Copy, Clone)]
pub struct $Msg$View<'a> {
_msg: $pbi$::RawMessage,
_phantom: std::marker::PhantomData<&'a ()>,
_phantom: $Phantom$<&'a ()>,
}
impl<'a> $pb$::ViewProxy<'a> for $Msg$View<'a> {
@ -323,7 +323,7 @@ void MessageGenerator::GenerateRs(Context<Descriptor> msg) {
#[derive(Debug)]
pub struct $Msg$Mut<'a> {
_phantom: std::marker::PhantomData<&'a mut ()>,
_phantom: $Phantom$<&'a mut ()>,
}
impl<'a> $pb$::MutProxy<'a> for $Msg$Mut<'a> {

Loading…
Cancel
Save