Clean up some trivial lifetime usage
- Rename most usage of `'a` to `'msg`
- Remove a no-op unused lifetime param for `remove` in maps
- Elide lifetimes recommended by clippy
PiperOrigin-RevId: 589878364
diff --git a/rust/cpp.rs b/rust/cpp.rs
index d5743f6..2090a66 100644
--- a/rust/cpp.rs
+++ b/rust/cpp.rs
@@ -141,7 +141,7 @@
pub type BytesPresentMutData<'msg> = crate::vtable::RawVTableOptionalMutatorData<'msg, [u8]>;
pub type BytesAbsentMutData<'msg> = crate::vtable::RawVTableOptionalMutatorData<'msg, [u8]>;
pub type InnerBytesMut<'msg> = crate::vtable::RawVTableMutator<'msg, [u8]>;
-pub type InnerPrimitiveMut<'a, T> = crate::vtable::RawVTableMutator<'a, T>;
+pub type InnerPrimitiveMut<'msg, T> = crate::vtable::RawVTableMutator<'msg, T>;
/// The raw contents of every generated message.
#[derive(Debug)]
@@ -187,10 +187,10 @@
}
}
-pub fn copy_bytes_in_arena_if_needed_by_runtime<'a>(
- _msg_ref: MutatorMessageRef<'a>,
- val: &'a [u8],
-) -> &'a [u8] {
+pub fn copy_bytes_in_arena_if_needed_by_runtime<'msg>(
+ _msg_ref: MutatorMessageRef<'msg>,
+ val: &'msg [u8],
+) -> &'msg [u8] {
// Nothing to do, the message manages its own string memory for C++.
val
}
@@ -341,14 +341,14 @@
paste! {
$(
pub trait [< MapWith $t:camel KeyOps >] {
- type Value<'a>: Sized;
+ type Value<'msg>: Sized;
fn new_map() -> RawMap;
fn clear(m: RawMap);
fn size(m: RawMap) -> usize;
fn insert(m: RawMap, key: $sized_t, value: Self::Value<'_>) -> bool;
- fn get<'a>(m: RawMap, key: $sized_t) -> Option<Self::Value<'a>>;
- fn remove<'a>(m: RawMap, key: $sized_t) -> bool;
+ fn get<'msg>(m: RawMap, key: $sized_t) -> Option<Self::Value<'msg>>;
+ fn remove(m: RawMap, key: $sized_t) -> bool;
}
impl<'msg, V: [< MapWith $t:camel KeyOps >] + ?Sized> Default for MapInner<'msg, $t, V> {
@@ -374,7 +374,7 @@
V::get(self.raw, key)
}
- pub fn remove<'a>(&mut self, key: $sized_t) -> bool {
+ pub fn remove(&mut self, key: $sized_t) -> bool {
V::remove(self.raw, key)
}
@@ -409,7 +409,7 @@
fn [< __pb_rust_Map_ $key_t _ $t _remove >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_t) -> bool;
}
impl $trait for $t {
- type Value<'a> = $sized_t;
+ type Value<'msg> = $sized_t;
fn new_map() -> RawMap {
unsafe { [< __pb_rust_Map_ $key_t _ $t _new >]() }
@@ -430,7 +430,7 @@
true
}
- fn get<'a>(m: RawMap, key: $sized_key_t) -> Option<Self::Value<'a>> {
+ fn get<'msg>(m: RawMap, key: $sized_key_t) -> Option<Self::Value<'msg>> {
let ffi_key = $to_ffi_key(key);
let mut ffi_value = $to_ffi_value($zero_val);
let found = unsafe { [< __pb_rust_Map_ $key_t _ $t _get >](m, ffi_key, &mut ffi_value) };
@@ -440,7 +440,7 @@
Some($from_ffi_value(ffi_value))
}
- fn remove<'a>(m: RawMap, key: $sized_key_t) -> bool {
+ fn remove(m: RawMap, key: $sized_key_t) -> bool {
let ffi_key = $to_ffi_key(key);
let mut ffi_value = $to_ffi_value($zero_val);
unsafe { [< __pb_rust_Map_ $key_t _ $t _remove >](m, ffi_key, &mut ffi_value) }
@@ -450,11 +450,11 @@
}
}
-fn str_to_ptrlen<'a>(val: impl Into<&'a ProtoStr>) -> PtrAndLen {
+fn str_to_ptrlen<'msg>(val: impl Into<&'msg ProtoStr>) -> PtrAndLen {
val.into().as_bytes().into()
}
-fn ptrlen_to_str<'a>(val: PtrAndLen) -> &'a ProtoStr {
+fn ptrlen_to_str<'msg>(val: PtrAndLen) -> &'msg ProtoStr {
unsafe { ProtoStr::from_utf8_unchecked(val.as_ref()) }
}
@@ -470,7 +470,7 @@
i64, i64, i64, identity, identity, 0i64;
u64, u64, u64, identity, identity, 0u64;
bool, bool, bool, identity, identity, false;
- ProtoStr, &'a ProtoStr, PtrAndLen, str_to_ptrlen, ptrlen_to_str, "";
+ ProtoStr, &'msg ProtoStr, PtrAndLen, str_to_ptrlen, ptrlen_to_str, "";
);
)*
}
diff --git a/rust/map.rs b/rust/map.rs
index 9f6a11c..795c107 100644
--- a/rust/map.rs
+++ b/rust/map.rs
@@ -17,27 +17,27 @@
use std::marker::PhantomData;
#[repr(transparent)]
-pub struct MapView<'a, K: ?Sized, V: ?Sized> {
- inner: MapInner<'a, K, V>,
+pub struct MapView<'msg, K: ?Sized, V: ?Sized> {
+ inner: MapInner<'msg, K, V>,
}
-impl<'a, K: ?Sized, V: ?Sized> MapView<'a, K, V> {
- pub fn from_inner(_private: Private, inner: MapInner<'a, K, V>) -> Self {
+impl<'msg, K: ?Sized, V: ?Sized> MapView<'msg, K, V> {
+ pub fn from_inner(_private: Private, inner: MapInner<'msg, K, V>) -> Self {
Self { inner }
}
}
-impl<'a, K: ?Sized, V: ?Sized> Copy for MapView<'a, K, V> {}
-impl<'a, K: ?Sized, V: ?Sized> Clone for MapView<'a, K, V> {
+impl<'msg, K: ?Sized, V: ?Sized> Copy for MapView<'msg, K, V> {}
+impl<'msg, K: ?Sized, V: ?Sized> Clone for MapView<'msg, K, V> {
fn clone(&self) -> Self {
*self
}
}
-unsafe impl<'a, K: ?Sized, V: ?Sized> Sync for MapView<'a, K, V> {}
-unsafe impl<'a, K: ?Sized, V: ?Sized> Send for MapView<'a, K, V> {}
+unsafe impl<'msg, K: ?Sized, V: ?Sized> Sync for MapView<'msg, K, V> {}
+unsafe impl<'msg, K: ?Sized, V: ?Sized> Send for MapView<'msg, K, V> {}
-impl<'a, K: ?Sized, V: ?Sized> std::fmt::Debug for MapView<'a, K, V> {
+impl<'msg, K: ?Sized, V: ?Sized> std::fmt::Debug for MapView<'msg, K, V> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("MapView")
.field(&std::any::type_name::<K>())
@@ -47,19 +47,19 @@
}
#[repr(transparent)]
-pub struct MapMut<'a, K: ?Sized, V: ?Sized> {
- inner: MapInner<'a, K, V>,
+pub struct MapMut<'msg, K: ?Sized, V: ?Sized> {
+ inner: MapInner<'msg, K, V>,
}
-impl<'a, K: ?Sized, V: ?Sized> MapMut<'a, K, V> {
- pub fn from_inner(_private: Private, inner: MapInner<'a, K, V>) -> Self {
+impl<'msg, K: ?Sized, V: ?Sized> MapMut<'msg, K, V> {
+ pub fn from_inner(_private: Private, inner: MapInner<'msg, K, V>) -> Self {
Self { inner }
}
}
-unsafe impl<'a, K: ?Sized, V: ?Sized> Sync for MapMut<'a, K, V> {}
+unsafe impl<'msg, K: ?Sized, V: ?Sized> Sync for MapMut<'msg, K, V> {}
-impl<'a, K: ?Sized, V: ?Sized> std::fmt::Debug for MapMut<'a, K, V> {
+impl<'msg, K: ?Sized, V: ?Sized> std::fmt::Debug for MapMut<'msg, K, V> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("MapMut")
.field(&std::any::type_name::<K>())
@@ -68,14 +68,14 @@
}
}
-impl<'a, K: ?Sized, V: ?Sized> std::ops::Deref for MapMut<'a, K, V> {
- type Target = MapView<'a, K, V>;
+impl<'msg, K: ?Sized, V: ?Sized> std::ops::Deref for MapMut<'msg, K, V> {
+ type Target = MapView<'msg, K, V>;
fn deref(&self) -> &Self::Target {
// SAFETY:
- // - `Map{View,Mut}<'a, T>` are both `#[repr(transparent)]` over `MapInner<'a,
- // T>`.
+ // - `Map{View,Mut}<'msg, T>` are both `#[repr(transparent)]` over
+ // `MapInner<'msg, T>`.
// - `MapInner` is a type alias for `NonNull`.
- unsafe { &*(self as *const Self as *const MapView<'a, K, V>) }
+ unsafe { &*(self as *const Self as *const MapView<'msg, K, V>) }
}
}
@@ -87,11 +87,11 @@
($(key_type $t:ty;)*) => {
paste! { $(
impl<V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized> Proxied for Map<$t, V>{
- type View<'a> = MapView<'a, $t, V> where V: 'a;
- type Mut<'a> = MapMut<'a, $t, V> where V: 'a;
+ type View<'msg> = MapView<'msg, $t, V> where V: 'msg;
+ type Mut<'msg> = MapMut<'msg, $t, V> where V: 'msg;
}
- impl<'a, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'a> SettableValue<Map<$t, V>> for MapView<'a, $t, V> {
+ impl<'msg, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'msg> SettableValue<Map<$t, V>> for MapView<'msg, $t, V> {
fn set_on<'b>(self, _private: Private, mut mutator: Mut<'b, Map<$t, V>>)
where
Map<$t, V>: 'b {
@@ -99,7 +99,7 @@
}
}
- impl<'a, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'a> ViewProxy<'a> for MapView<'a, $t, V> {
+ impl<'msg, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'msg> ViewProxy<'msg> for MapView<'msg, $t, V> {
type Proxied = Map<$t, V>;
fn as_view(&self) -> View<'_, Self::Proxied> {
@@ -107,13 +107,13 @@
}
fn into_view<'shorter>(self) -> View<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
MapView { inner: self.inner }
}
}
- impl<'a, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'a> ViewProxy<'a> for MapMut<'a, $t, V> {
+ impl<'msg, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'msg> ViewProxy<'msg> for MapMut<'msg, $t, V> {
type Proxied = Map<$t, V>;
fn as_view(&self) -> View<'_, Self::Proxied> {
@@ -121,19 +121,19 @@
}
fn into_view<'shorter>(self) -> View<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
*self.into_mut::<'shorter>()
}
}
- impl<'a, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'a> MutProxy<'a> for MapMut<'a, $t, V> {
+ impl<'msg, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'msg> MutProxy<'msg> for MapMut<'msg, $t, V> {
fn as_mut(&mut self) -> Mut<'_, Self::Proxied> {
MapMut { inner: self.inner }
}
fn into_mut<'shorter>(self) -> Mut<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
MapMut { inner: self.inner }
}
@@ -154,7 +154,7 @@
macro_rules! impl_scalar_map_keys {
($(key_type $t:ty;)*) => {
paste! { $(
- impl<'a, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'a> MapView<'a, $t, V> {
+ impl<'msg, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'msg> MapView<'msg, $t, V> {
pub fn get<'b>(&self, key: $t) -> Option<V::Value<'b>> {
self.inner.get(key)
}
@@ -168,7 +168,7 @@
}
}
- impl<'a, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'a> MapMut<'a, $t, V> {
+ impl<'msg, V: [< MapWith $t:camel KeyOps >] + Proxied + ?Sized + 'msg> MapMut<'msg, $t, V> {
pub fn insert(&mut self, key: $t, value: V::Value<'_>) -> bool {
self.inner.insert(key, value)
}
@@ -197,8 +197,8 @@
key_type bool;
);
-impl<'a, V: MapWithProtoStrKeyOps + Proxied + ?Sized + 'a> MapView<'a, ProtoStr, V> {
- pub fn get(&self, key: impl Into<&'a ProtoStr>) -> Option<V::Value<'_>> {
+impl<'msg, V: MapWithProtoStrKeyOps + Proxied + ?Sized + 'msg> MapView<'msg, ProtoStr, V> {
+ pub fn get(&self, key: impl Into<&'msg ProtoStr>) -> Option<V::Value<'_>> {
self.inner.get(key.into())
}
@@ -211,12 +211,12 @@
}
}
-impl<'a, V: MapWithProtoStrKeyOps + Proxied + ?Sized + 'a> MapMut<'a, ProtoStr, V> {
- pub fn insert(&mut self, key: impl Into<&'a ProtoStr>, value: V::Value<'_>) -> bool {
+impl<'msg, V: MapWithProtoStrKeyOps + Proxied + ?Sized + 'msg> MapMut<'msg, ProtoStr, V> {
+ pub fn insert(&mut self, key: impl Into<&'msg ProtoStr>, value: V::Value<'_>) -> bool {
self.inner.insert(key.into(), value)
}
- pub fn remove(&mut self, key: impl Into<&'a ProtoStr>) -> bool {
+ pub fn remove(&mut self, key: impl Into<&'msg ProtoStr>) -> bool {
self.inner.remove(key.into())
}
diff --git a/rust/optional.rs b/rust/optional.rs
index ba9955b..0268c61 100644
--- a/rust/optional.rs
+++ b/rust/optional.rs
@@ -83,7 +83,7 @@
/// A mutable view into the value of an optional field, which may be set or
/// unset.
-pub type FieldEntry<'a, T> = Optional<PresentField<'a, T>, AbsentField<'a, T>>;
+pub type FieldEntry<'msg, T> = Optional<PresentField<'msg, T>, AbsentField<'msg, T>>;
/// Methods for `_mut()` accessors of optional types.
///
@@ -285,11 +285,11 @@
/// A field mutator capable of setting that is statically known to point to a
/// non-set field.
-pub struct AbsentField<'a, T>
+pub struct AbsentField<'msg, T>
where
- T: ProxiedWithPresence + ?Sized + 'a,
+ T: ProxiedWithPresence + ?Sized + 'msg,
{
- pub(crate) inner: T::AbsentMutData<'a>,
+ pub(crate) inner: T::AbsentMutData<'msg>,
}
impl<'msg, T: ProxiedWithPresence + ?Sized + 'msg> Debug for AbsentField<'msg, T> {
@@ -432,10 +432,10 @@
}
}
- fn make_field_entry<'a>(
- msg: &'a mut MyMessage,
- vtable: &'a ProxyVtable,
- ) -> FieldEntry<'a, VtableProxied> {
+ fn make_field_entry<'msg>(
+ msg: &'msg mut MyMessage,
+ vtable: &'msg ProxyVtable,
+ ) -> FieldEntry<'msg, VtableProxied> {
if (vtable.has)(&*msg) {
Optional::Set(PresentField::from_inner(Private, VtableProxiedMut { msg, vtable }))
} else {
@@ -494,8 +494,8 @@
struct VtableProxied;
impl Proxied for VtableProxied {
- type View<'a> = VtableProxiedView;
- type Mut<'a> = VtableProxiedMut<'a>;
+ type View<'msg> = VtableProxiedView;
+ type Mut<'msg> = VtableProxiedMut<'msg>;
}
impl ProxiedWithPresence for VtableProxied {
@@ -503,19 +503,19 @@
// `Mut` in layout. Other types/runtimes could require otherwise, e.g. `Mut`
// could be defined to only have get/set functions in its vtable, and not
// has/clear.
- type PresentMutData<'a> = VtableProxiedMut<'a>;
- type AbsentMutData<'a> = VtableProxiedMut<'a>;
+ type PresentMutData<'msg> = VtableProxiedMut<'msg>;
+ type AbsentMutData<'msg> = VtableProxiedMut<'msg>;
- fn clear_present_field<'a>(
- present_mutator: Self::PresentMutData<'a>,
- ) -> Self::AbsentMutData<'a> {
+ fn clear_present_field<'msg>(
+ present_mutator: Self::PresentMutData<'msg>,
+ ) -> Self::AbsentMutData<'msg> {
(present_mutator.vtable.clear)(&mut *present_mutator.msg);
present_mutator
}
- fn set_absent_to_default<'a>(
- absent_mutator: Self::AbsentMutData<'a>,
- ) -> Self::PresentMutData<'a> {
+ fn set_absent_to_default<'msg>(
+ absent_mutator: Self::AbsentMutData<'msg>,
+ ) -> Self::PresentMutData<'msg> {
SettableValue::<VtableProxied>::set_on_absent(
absent_mutator.as_view().val(),
Private,
@@ -539,28 +539,28 @@
}
}
- impl<'a> ViewProxy<'a> for VtableProxiedView {
+ impl<'msg> ViewProxy<'msg> for VtableProxiedView {
type Proxied = VtableProxied;
- fn as_view(&self) -> View<'a, VtableProxied> {
+ fn as_view(&self) -> View<'msg, VtableProxied> {
*self
}
fn into_view<'shorter>(self) -> View<'shorter, VtableProxied>
where
- 'a: 'shorter,
+ 'msg: 'shorter,
{
self
}
}
#[derive(Debug)]
- struct VtableProxiedMut<'a> {
- msg: &'a mut MyMessage,
- vtable: &'a ProxyVtable,
+ struct VtableProxiedMut<'msg> {
+ msg: &'msg mut MyMessage,
+ vtable: &'msg ProxyVtable,
}
- impl<'a> ViewProxy<'a> for VtableProxiedMut<'a> {
+ impl<'msg> ViewProxy<'msg> for VtableProxiedMut<'msg> {
type Proxied = VtableProxied;
fn as_view(&self) -> View<'_, VtableProxied> {
@@ -569,55 +569,55 @@
fn into_view<'shorter>(self) -> View<'shorter, VtableProxied>
where
- 'a: 'shorter,
+ 'msg: 'shorter,
{
VtableProxiedView::read(self.msg, self.vtable)
}
}
- impl<'a> MutProxy<'a> for VtableProxiedMut<'a> {
+ impl<'msg> MutProxy<'msg> for VtableProxiedMut<'msg> {
fn as_mut(&mut self) -> Mut<'_, VtableProxied> {
VtableProxiedMut { msg: self.msg, vtable: self.vtable }
}
fn into_mut<'shorter>(self) -> Mut<'shorter, VtableProxied>
where
- 'a: 'shorter,
+ 'msg: 'shorter,
{
self
}
}
impl SettableValue<VtableProxied> for View<'_, VtableProxied> {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, VtableProxied>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, VtableProxied>)
where
- VtableProxied: 'a,
+ VtableProxied: 'msg,
{
SettableValue::<VtableProxied>::set_on(self.val(), Private, mutator)
}
- fn set_on_absent<'a>(
+ fn set_on_absent<'msg>(
self,
_private: Private,
- absent_mutator: <VtableProxied as ProxiedWithPresence>::AbsentMutData<'a>,
- ) -> <VtableProxied as ProxiedWithPresence>::PresentMutData<'a> {
+ absent_mutator: <VtableProxied as ProxiedWithPresence>::AbsentMutData<'msg>,
+ ) -> <VtableProxied as ProxiedWithPresence>::PresentMutData<'msg> {
SettableValue::<VtableProxied>::set_on_absent(self.val(), Private, absent_mutator)
}
}
impl SettableValue<VtableProxied> for i32 {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, VtableProxied>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, VtableProxied>)
where
- VtableProxied: 'a,
+ VtableProxied: 'msg,
{
(mutator.vtable.set)(mutator.msg, self)
}
- fn set_on_absent<'a>(
+ fn set_on_absent<'msg>(
self,
_private: Private,
- absent_mutator: <VtableProxied as ProxiedWithPresence>::AbsentMutData<'a>,
- ) -> <VtableProxied as ProxiedWithPresence>::PresentMutData<'a> {
+ absent_mutator: <VtableProxied as ProxiedWithPresence>::AbsentMutData<'msg>,
+ ) -> <VtableProxied as ProxiedWithPresence>::PresentMutData<'msg> {
(absent_mutator.vtable.set)(absent_mutator.msg, self);
absent_mutator
}
diff --git a/rust/primitive.rs b/rust/primitive.rs
index 0b81d2e..bf4d632 100644
--- a/rust/primitive.rs
+++ b/rust/primitive.rs
@@ -14,28 +14,28 @@
use crate::{Mut, MutProxy, Proxied, ProxiedWithPresence, SettableValue, View, ViewProxy};
#[derive(Debug)]
-pub struct PrimitiveMut<'a, T: ProxiedWithRawVTable> {
- inner: InnerPrimitiveMut<'a, T>,
+pub struct PrimitiveMut<'msg, T: ProxiedWithRawVTable> {
+ inner: InnerPrimitiveMut<'msg, T>,
}
-impl<'a, T: ProxiedWithRawVTable> PrimitiveMut<'a, T> {
+impl<'msg, T: ProxiedWithRawVTable> PrimitiveMut<'msg, T> {
#[doc(hidden)]
- pub fn from_inner(_private: Private, inner: InnerPrimitiveMut<'a, T>) -> Self {
+ pub fn from_inner(_private: Private, inner: InnerPrimitiveMut<'msg, T>) -> Self {
Self { inner }
}
}
-unsafe impl<'a, T: ProxiedWithRawVTable> Sync for PrimitiveMut<'a, T> {}
+unsafe impl<'msg, T: ProxiedWithRawVTable> Sync for PrimitiveMut<'msg, T> {}
macro_rules! impl_singular_primitives {
($($t:ty),*) => {
$(
impl Proxied for $t {
- type View<'a> = $t;
- type Mut<'a> = PrimitiveMut<'a, $t>;
+ type View<'msg> = $t;
+ type Mut<'msg> = PrimitiveMut<'msg, $t>;
}
- impl<'a> ViewProxy<'a> for $t {
+ impl<'msg> ViewProxy<'msg> for $t {
type Proxied = $t;
fn as_view(&self) -> View<'_, Self::Proxied> {
@@ -47,7 +47,7 @@
}
}
- impl<'a> PrimitiveMut<'a, $t> {
+ impl<'msg> PrimitiveMut<'msg, $t> {
pub fn get(&self) -> View<'_, $t> {
self.inner.get()
}
@@ -57,7 +57,7 @@
}
}
- impl<'a> ViewProxy<'a> for PrimitiveMut<'a, $t> {
+ impl<'msg> ViewProxy<'msg> for PrimitiveMut<'msg, $t> {
type Proxied = $t;
fn as_view(&self) -> View<'_, Self::Proxied> {
@@ -69,21 +69,21 @@
}
}
- impl<'a> MutProxy<'a> for PrimitiveMut<'a, $t> {
+ impl<'msg> MutProxy<'msg> for PrimitiveMut<'msg, $t> {
fn as_mut(&mut self) -> Mut<'_, Self::Proxied> {
PrimitiveMut { inner: self.inner }
}
fn into_mut<'shorter>(self) -> Mut<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
self
}
}
impl SettableValue<$t> for $t {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, $t>) where $t: 'a {
- // SAFETY: the raw mutator is valid for `'a` as enforced by `Mut`
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, $t>) where $t: 'msg {
+ // SAFETY: the raw mutator is valid for `'msg` as enforced by `Mut`
unsafe { mutator.inner.set(self) }
}
}
@@ -104,8 +104,8 @@
}
impl ProxiedWithPresence for $t {
- type PresentMutData<'a> = RawVTableOptionalMutatorData<'a, $t>;
- type AbsentMutData<'a> = RawVTableOptionalMutatorData<'a, $t>;
+ type PresentMutData<'msg> = RawVTableOptionalMutatorData<'msg, $t>;
+ type AbsentMutData<'msg> = RawVTableOptionalMutatorData<'msg, $t>;
fn clear_present_field(
present_mutator: Self::PresentMutData<'_>,
diff --git a/rust/proxied.rs b/rust/proxied.rs
index c3da62d..44bb3e1 100644
--- a/rust/proxied.rs
+++ b/rust/proxied.rs
@@ -55,47 +55,47 @@
///
/// All Protobuf field types implement `Proxied`.
pub trait Proxied {
- /// The proxy type that provides shared access to a `T`, like a `&'a T`.
+ /// The proxy type that provides shared access to a `T`, like a `&'msg T`.
///
/// Most code should use the type alias [`View`].
- type View<'a>: ViewProxy<'a, Proxied = Self> + Copy + Send + SettableValue<Self>
+ type View<'msg>: ViewProxy<'msg, Proxied = Self> + Copy + Send + SettableValue<Self>
where
- Self: 'a;
+ Self: 'msg;
/// The proxy type that provides exclusive mutable access to a `T`, like a
- /// `&'a mut T`.
+ /// `&'msg mut T`.
///
/// Most code should use the type alias [`Mut`].
- type Mut<'a>: MutProxy<'a, Proxied = Self>
+ type Mut<'msg>: MutProxy<'msg, Proxied = Self>
where
- Self: 'a;
+ Self: 'msg;
}
-/// A proxy type that provides shared access to a `T`, like a `&'a T`.
+/// A proxy type that provides shared access to a `T`, like a `&'msg T`.
///
/// This is more concise than fully spelling the associated type.
#[allow(dead_code)]
-pub type View<'a, T> = <T as Proxied>::View<'a>;
+pub type View<'msg, T> = <T as Proxied>::View<'msg>;
/// A proxy type that provides exclusive mutable access to a `T`, like a
-/// `&'a mut T`.
+/// `&'msg mut T`.
///
/// This is more concise than fully spelling the associated type.
#[allow(dead_code)]
-pub type Mut<'a, T> = <T as Proxied>::Mut<'a>;
+pub type Mut<'msg, T> = <T as Proxied>::Mut<'msg>;
/// Declares conversion operations common to all views.
///
/// This trait is intentionally made non-object-safe to prevent a potential
/// future incompatible change.
-pub trait ViewProxy<'a>: 'a + Sized + Sync + Unpin + Sized + Debug {
- type Proxied: 'a + Proxied + ?Sized;
+pub trait ViewProxy<'msg>: 'msg + Sized + Sync + Unpin + Sized + Debug {
+ type Proxied: 'msg + Proxied + ?Sized;
/// Converts a borrow into a `View` with the lifetime of that borrow.
///
/// In non-generic code we don't need to use `as_view` because the proxy
- /// types are covariant over `'a`. However, generic code conservatively
- /// treats `'a` as [invariant], therefore we need to call
+ /// types are covariant over `'msg`. However, generic code conservatively
+ /// treats `'msg` as [invariant], therefore we need to call
/// `as_view` to explicitly perform the operation that in concrete code
/// coercion would perform implicitly.
///
@@ -115,8 +115,8 @@
/// Converts into a `View` with a potentially shorter lifetime.
///
/// In non-generic code we don't need to use `into_view` because the proxy
- /// types are covariant over `'a`. However, generic code conservatively
- /// treats `'a` as [invariant], therefore we need to call
+ /// types are covariant over `'msg`. However, generic code conservatively
+ /// treats `'msg` as [invariant], therefore we need to call
/// `into_view` to explicitly perform the operation that in concrete
/// code coercion would perform implicitly.
///
@@ -139,14 +139,14 @@
/// [invariant]: https://doc.rust-lang.org/nomicon/subtyping.html#variance
fn into_view<'shorter>(self) -> View<'shorter, Self::Proxied>
where
- 'a: 'shorter;
+ 'msg: 'shorter;
}
/// Declares operations common to all mutators.
///
/// This trait is intentionally made non-object-safe to prevent a potential
/// future incompatible change.
-pub trait MutProxy<'a>: ViewProxy<'a> {
+pub trait MutProxy<'msg>: ViewProxy<'msg> {
/// Gets an immutable view of this field. This is shorthand for `as_view`.
///
/// This provides a shorter lifetime than `into_view` but can also be called
@@ -181,8 +181,8 @@
/// Converts into a `Mut` with a potentially shorter lifetime.
///
/// In non-generic code we don't need to use `into_mut` because the proxy
- /// types are covariant over `'a`. However, generic code conservatively
- /// treats `'a` as [invariant], therefore we need to call
+ /// types are covariant over `'msg`. However, generic code conservatively
+ /// treats `'msg` as [invariant], therefore we need to call
/// `into_mut` to explicitly perform the operation that in concrete code
/// coercion would perform implicitly.
///
@@ -202,7 +202,7 @@
/// [invariant]: https://doc.rust-lang.org/nomicon/subtyping.html#variance
fn into_mut<'shorter>(self) -> Mut<'shorter, Self::Proxied>
where
- 'a: 'shorter;
+ 'msg: 'shorter;
}
/// `Proxied` types that can be optionally set or unset.
@@ -211,25 +211,21 @@
/// types don't.
pub trait ProxiedWithPresence: Proxied {
/// The data necessary to store a present field mutator proxying `Self`.
- /// This is the contents of `PresentField<'a, Self>`.
- type PresentMutData<'a>: MutProxy<'a, Proxied = Self>;
+ /// This is the contents of `PresentField<'msg, Self>`.
+ type PresentMutData<'msg>: MutProxy<'msg, Proxied = Self>;
/// The data necessary to store an absent field mutator proxying `Self`.
- /// This is the contents of `AbsentField<'a, Self>`.
- type AbsentMutData<'a>: ViewProxy<'a, Proxied = Self>;
+ /// This is the contents of `AbsentField<'msg, Self>`.
+ type AbsentMutData<'msg>: ViewProxy<'msg, Proxied = Self>;
/// Clears a present field.
- fn clear_present_field<'a>(
- present_mutator: Self::PresentMutData<'a>,
- ) -> Self::AbsentMutData<'a>;
+ fn clear_present_field(present_mutator: Self::PresentMutData<'_>) -> Self::AbsentMutData<'_>;
/// Sets an absent field to its default value.
///
/// This can be more efficient than setting with a default value, e.g.
/// a default submessage could share resources with the parent message.
- fn set_absent_to_default<'a>(
- absent_mutator: Self::AbsentMutData<'a>,
- ) -> Self::PresentMutData<'a>;
+ fn set_absent_to_default(absent_mutator: Self::AbsentMutData<'_>) -> Self::PresentMutData<'_>;
}
/// Values that can be used to set a field of `T`.
@@ -239,18 +235,18 @@
{
/// Consumes `self` to set the given mutator to its value.
#[doc(hidden)]
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, T>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, T>)
where
- T: 'a;
+ T: 'msg;
/// Consumes `self` and `absent_mutator` to set the given empty field to
/// a value.
#[doc(hidden)]
- fn set_on_absent<'a>(
+ fn set_on_absent(
self,
_private: Private,
- absent_mutator: T::AbsentMutData<'a>,
- ) -> T::PresentMutData<'a>
+ absent_mutator: T::AbsentMutData<'_>,
+ ) -> T::PresentMutData<'_>
where
T: ProxiedWithPresence,
{
@@ -291,13 +287,13 @@
}
impl Proxied for MyProxied {
- type View<'a> = MyProxiedView<'a>;
- type Mut<'a> = MyProxiedMut<'a>;
+ type View<'msg> = MyProxiedView<'msg>;
+ type Mut<'msg> = MyProxiedMut<'msg>;
}
#[derive(Debug, Clone, Copy)]
- struct MyProxiedView<'a> {
- my_proxied_ref: &'a MyProxied,
+ struct MyProxiedView<'msg> {
+ my_proxied_ref: &'msg MyProxied,
}
impl MyProxiedView<'_> {
@@ -306,27 +302,27 @@
}
}
- impl<'a> ViewProxy<'a> for MyProxiedView<'a> {
+ impl<'msg> ViewProxy<'msg> for MyProxiedView<'msg> {
type Proxied = MyProxied;
- fn as_view(&self) -> View<'a, MyProxied> {
+ fn as_view(&self) -> View<'msg, MyProxied> {
*self
}
fn into_view<'shorter>(self) -> View<'shorter, MyProxied>
where
- 'a: 'shorter,
+ 'msg: 'shorter,
{
self
}
}
#[derive(Debug)]
- struct MyProxiedMut<'a> {
- my_proxied_ref: &'a mut MyProxied,
+ struct MyProxiedMut<'msg> {
+ my_proxied_ref: &'msg mut MyProxied,
}
- impl<'a> ViewProxy<'a> for MyProxiedMut<'a> {
+ impl<'msg> ViewProxy<'msg> for MyProxiedMut<'msg> {
type Proxied = MyProxied;
fn as_view(&self) -> View<'_, MyProxied> {
@@ -334,56 +330,56 @@
}
fn into_view<'shorter>(self) -> View<'shorter, MyProxied>
where
- 'a: 'shorter,
+ 'msg: 'shorter,
{
MyProxiedView { my_proxied_ref: self.my_proxied_ref }
}
}
- impl<'a> MutProxy<'a> for MyProxiedMut<'a> {
+ impl<'msg> MutProxy<'msg> for MyProxiedMut<'msg> {
fn as_mut(&mut self) -> Mut<'_, MyProxied> {
MyProxiedMut { my_proxied_ref: self.my_proxied_ref }
}
fn into_mut<'shorter>(self) -> Mut<'shorter, MyProxied>
where
- 'a: 'shorter,
+ 'msg: 'shorter,
{
self
}
}
impl SettableValue<MyProxied> for MyProxiedView<'_> {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, MyProxied>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, MyProxied>)
where
- MyProxied: 'a,
+ MyProxied: 'msg,
{
mutator.my_proxied_ref.val = self.my_proxied_ref.val.clone();
}
}
impl SettableValue<MyProxied> for String {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, MyProxied>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, MyProxied>)
where
- MyProxied: 'a,
+ MyProxied: 'msg,
{
mutator.my_proxied_ref.val = self;
}
}
impl SettableValue<MyProxied> for &'_ str {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, MyProxied>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, MyProxied>)
where
- MyProxied: 'a,
+ MyProxied: 'msg,
{
mutator.my_proxied_ref.val.replace_range(.., self);
}
}
impl SettableValue<MyProxied> for Cow<'_, str> {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, MyProxied>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, MyProxied>)
where
- MyProxied: 'a,
+ MyProxied: 'msg,
{
match self {
Cow::Owned(x) => <String as SettableValue<MyProxied>>::set_on(x, Private, mutator),
@@ -413,7 +409,7 @@
assert_eq!(my_proxied.val, "Hello indeed");
}
- fn reborrow_mut_into_view<'a>(x: Mut<'a, MyProxied>) -> View<'a, MyProxied> {
+ fn reborrow_mut_into_view<'msg>(x: Mut<'msg, MyProxied>) -> View<'msg, MyProxied> {
// x.as_view() fails to compile with:
// `ERROR: attempt to return function-local borrowed content`
x.into_view() // OK: we return the same lifetime as we got in.
@@ -425,7 +421,7 @@
reborrow_mut_into_view(my_proxied.as_mut());
}
- fn require_unified_lifetimes<'a>(_x: Mut<'a, MyProxied>, _y: View<'a, MyProxied>) {}
+ fn require_unified_lifetimes<'msg>(_x: Mut<'msg, MyProxied>, _y: View<'msg, MyProxied>) {}
#[test]
fn test_require_unified_lifetimes() {
diff --git a/rust/repeated.rs b/rust/repeated.rs
index 19b64bc..af0f513 100644
--- a/rust/repeated.rs
+++ b/rust/repeated.rs
@@ -19,22 +19,22 @@
};
#[derive(Clone, Copy)]
-pub struct RepeatedFieldRef<'a> {
+pub struct RepeatedFieldRef<'msg> {
pub repeated_field: RawRepeatedField,
- pub _phantom: PhantomData<&'a mut ()>,
+ pub _phantom: PhantomData<&'msg mut ()>,
}
-unsafe impl<'a> Send for RepeatedFieldRef<'a> {}
-unsafe impl<'a> Sync for RepeatedFieldRef<'a> {}
+unsafe impl<'msg> Send for RepeatedFieldRef<'msg> {}
+unsafe impl<'msg> Sync for RepeatedFieldRef<'msg> {}
#[derive(Clone, Copy)]
#[repr(transparent)]
-pub struct RepeatedView<'a, T: ?Sized> {
- inner: RepeatedField<'a, T>,
+pub struct RepeatedView<'msg, T: ?Sized> {
+ inner: RepeatedField<'msg, T>,
}
-unsafe impl<'a, T: ProxiedWithRawVTable> Sync for RepeatedView<'a, T> {}
-unsafe impl<'a, T: ProxiedWithRawVTable> Send for RepeatedView<'a, T> {}
+unsafe impl<'msg, T: ProxiedWithRawVTable> Sync for RepeatedView<'msg, T> {}
+unsafe impl<'msg, T: ProxiedWithRawVTable> Send for RepeatedView<'msg, T> {}
impl<'msg, T: ?Sized> RepeatedView<'msg, T> {
pub fn from_inner(_private: Private, inner: RepeatedFieldInner<'msg>) -> Self {
@@ -42,12 +42,12 @@
}
}
-pub struct RepeatedFieldIter<'a, T> {
- inner: RepeatedField<'a, T>,
+pub struct RepeatedFieldIter<'msg, T> {
+ inner: RepeatedField<'msg, T>,
current_index: usize,
}
-impl<'a, T> std::fmt::Debug for RepeatedView<'a, T> {
+impl<'msg, T> std::fmt::Debug for RepeatedView<'msg, T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("RepeatedView").finish()
}
@@ -55,11 +55,11 @@
#[repr(transparent)]
#[derive(Debug)]
-pub struct RepeatedMut<'a, T: ?Sized> {
- inner: RepeatedField<'a, T>,
+pub struct RepeatedMut<'msg, T: ?Sized> {
+ inner: RepeatedField<'msg, T>,
}
-unsafe impl<'a, T: ProxiedWithRawVTable> Sync for RepeatedMut<'a, T> {}
+unsafe impl<'msg, T: ProxiedWithRawVTable> Sync for RepeatedMut<'msg, T> {}
impl<'msg, T: ?Sized> RepeatedMut<'msg, T> {
pub fn from_inner(_private: Private, inner: RepeatedFieldInner<'msg>) -> Self {
@@ -70,14 +70,14 @@
}
}
-impl<'a, T> std::ops::Deref for RepeatedMut<'a, T> {
- type Target = RepeatedView<'a, T>;
+impl<'msg, T> std::ops::Deref for RepeatedMut<'msg, T> {
+ type Target = RepeatedView<'msg, T>;
fn deref(&self) -> &Self::Target {
// SAFETY:
- // - `Repeated{View,Mut}<'a, T>` are both `#[repr(transparent)]` over
- // `RepeatedField<'a, T>`.
+ // - `Repeated{View,Mut}<'msg, T>` are both `#[repr(transparent)]` over
+ // `RepeatedField<'msg, T>`.
// - `RepeatedField` is a type alias for `NonNull`.
- unsafe { &*(self as *const Self as *const RepeatedView<'a, T>) }
+ unsafe { &*(self as *const Self as *const RepeatedView<'msg, T>) }
}
}
@@ -87,11 +87,11 @@
($($t:ty),*) => {
$(
impl Proxied for Repeated<$t> {
- type View<'a> = RepeatedView<'a, $t>;
- type Mut<'a> = RepeatedMut<'a, $t>;
+ type View<'msg> = RepeatedView<'msg, $t>;
+ type Mut<'msg> = RepeatedMut<'msg, $t>;
}
- impl<'a> ViewProxy<'a> for RepeatedView<'a, $t> {
+ impl<'msg> ViewProxy<'msg> for RepeatedView<'msg, $t> {
type Proxied = Repeated<$t>;
fn as_view(&self) -> View<'_, Self::Proxied> {
@@ -99,13 +99,13 @@
}
fn into_view<'shorter>(self) -> View<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
RepeatedView { inner: self.inner }
}
}
- impl<'a> ViewProxy<'a> for RepeatedMut<'a, $t> {
+ impl<'msg> ViewProxy<'msg> for RepeatedMut<'msg, $t> {
type Proxied = Repeated<$t>;
fn as_view(&self) -> View<'_, Self::Proxied> {
@@ -113,25 +113,25 @@
}
fn into_view<'shorter>(self) -> View<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
*self.into_mut::<'shorter>()
}
}
- impl<'a> MutProxy<'a> for RepeatedMut<'a, $t> {
+ impl<'msg> MutProxy<'msg> for RepeatedMut<'msg, $t> {
fn as_mut(&mut self) -> Mut<'_, Self::Proxied> {
RepeatedMut { inner: self.inner }
}
fn into_mut<'shorter>(self) -> Mut<'shorter, Self::Proxied>
- where 'a: 'shorter,
+ where 'msg: 'shorter,
{
RepeatedMut { inner: self.inner }
}
}
- impl <'a> SettableValue<Repeated<$t>> for RepeatedView<'a, $t> {
+ impl <'msg> SettableValue<Repeated<$t>> for RepeatedView<'msg, $t> {
fn set_on<'b> (self, _private: Private, mut mutator: Mut<'b, Repeated<$t>>)
where
Repeated<$t>: 'b {
@@ -139,7 +139,7 @@
}
}
- impl<'a> RepeatedView<'a, $t> {
+ impl<'msg> RepeatedView<'msg, $t> {
pub fn len(&self) -> usize {
self.inner.len()
}
@@ -154,7 +154,7 @@
}
}
- impl<'a> RepeatedMut<'a, $t> {
+ impl<'msg> RepeatedMut<'msg, $t> {
pub fn push(&mut self, val: $t) {
self.inner.push(val)
}
@@ -169,7 +169,7 @@
}
}
- impl<'a> std::iter::Iterator for RepeatedFieldIter<'a, $t> {
+ impl<'msg> std::iter::Iterator for RepeatedFieldIter<'msg, $t> {
type Item = $t;
fn next(&mut self) -> Option<Self::Item> {
let val = self.inner.get(self.current_index);
@@ -180,9 +180,9 @@
}
}
- impl<'a> std::iter::IntoIterator for RepeatedView<'a, $t> {
+ impl<'msg> std::iter::IntoIterator for RepeatedView<'msg, $t> {
type Item = $t;
- type IntoIter = RepeatedFieldIter<'a, $t>;
+ type IntoIter = RepeatedFieldIter<'msg, $t>;
fn into_iter(self) -> Self::IntoIter {
RepeatedFieldIter { inner: self.inner, current_index: 0 }
}
diff --git a/rust/string.rs b/rust/string.rs
index aece6ba..dfaa519 100644
--- a/rust/string.rs
+++ b/rust/string.rs
@@ -128,15 +128,11 @@
type PresentMutData<'msg> = BytesPresentMutData<'msg>;
type AbsentMutData<'msg> = BytesAbsentMutData<'msg>;
- fn clear_present_field<'a>(
- present_mutator: Self::PresentMutData<'a>,
- ) -> Self::AbsentMutData<'a> {
+ fn clear_present_field(present_mutator: Self::PresentMutData<'_>) -> Self::AbsentMutData<'_> {
present_mutator.clear()
}
- fn set_absent_to_default<'a>(
- absent_mutator: Self::AbsentMutData<'a>,
- ) -> Self::PresentMutData<'a> {
+ fn set_absent_to_default(absent_mutator: Self::AbsentMutData<'_>) -> Self::PresentMutData<'_> {
absent_mutator.set_absent_to_default()
}
}
@@ -185,9 +181,9 @@
}
impl SettableValue<[u8]> for &'_ [u8] {
- fn set_on<'a>(self, _private: Private, mutator: Mut<'a, [u8]>)
+ fn set_on<'msg>(self, _private: Private, mutator: Mut<'msg, [u8]>)
where
- [u8]: 'a,
+ [u8]: 'msg,
{
// SAFETY: this is a `bytes` field with no restriction on UTF-8.
unsafe { mutator.inner.set(self) }
diff --git a/rust/upb.rs b/rust/upb.rs
index 50b67df..f618406 100644
--- a/rust/upb.rs
+++ b/rust/upb.rs
@@ -217,7 +217,7 @@
pub type BytesPresentMutData<'msg> = crate::vtable::RawVTableOptionalMutatorData<'msg, [u8]>;
pub type BytesAbsentMutData<'msg> = crate::vtable::RawVTableOptionalMutatorData<'msg, [u8]>;
pub type InnerBytesMut<'msg> = crate::vtable::RawVTableMutator<'msg, [u8]>;
-pub type InnerPrimitiveMut<'a, T> = crate::vtable::RawVTableMutator<'a, T>;
+pub type InnerPrimitiveMut<'msg, T> = crate::vtable::RawVTableMutator<'msg, T>;
/// The raw contents of every generated message.
#[derive(Debug)]
@@ -277,10 +277,10 @@
}
}
-pub fn copy_bytes_in_arena_if_needed_by_runtime<'a>(
- msg_ref: MutatorMessageRef<'a>,
- val: &'a [u8],
-) -> &'a [u8] {
+pub fn copy_bytes_in_arena_if_needed_by_runtime<'msg>(
+ msg_ref: MutatorMessageRef<'msg>,
+ val: &'msg [u8],
+) -> &'msg [u8] {
// SAFETY: the alignment of `[u8]` is less than `UPB_MALLOC_ALIGN`.
let new_alloc = unsafe { msg_ref.arena.alloc(Layout::for_value(val)) };
debug_assert_eq!(new_alloc.len(), val.len());
@@ -515,7 +515,7 @@
paste! {
$(
pub trait [< MapWith $t:camel KeyOps >] {
- type Value<'a>: Sized;
+ type Value<'msg>: Sized;
fn new_map(a: RawArena) -> RawMap;
fn clear(m: RawMap) {
@@ -525,8 +525,8 @@
unsafe { upb_Map_Size(m) }
}
fn insert(m: RawMap, a: RawArena, key: $sized_t, value: Self::Value<'_>) -> bool;
- fn get<'a>(m: RawMap, key: $sized_t) -> Option<Self::Value<'a>>;
- fn remove<'a>(m: RawMap, key: $sized_t) -> bool;
+ fn get<'msg>(m: RawMap, key: $sized_t) -> Option<Self::Value<'msg>>;
+ fn remove(m: RawMap, key: $sized_t) -> bool;
}
impl<'msg, V: [< MapWith $t:camel KeyOps >] + ?Sized> MapInner<'msg, $t, V> {
@@ -552,7 +552,7 @@
V::get(self.raw, key)
}
- pub fn remove<'a>(&mut self, key: $sized_t) -> bool {
+ pub fn remove(&mut self, key: $sized_t) -> bool {
V::remove(self.raw, key)
}
@@ -578,7 +578,7 @@
($key_t:ty, $key_msg_val:expr, $key_upb_tag:expr, $trait:ident for $($t:ty, $sized_t:ty, $msg_val:expr, $from_msg_val:expr, $upb_tag:expr, $zero_val:literal;)*) => {
$(
impl $trait for $t {
- type Value<'a> = $sized_t;
+ type Value<'msg> = $sized_t;
fn new_map(a: RawArena) -> RawMap {
unsafe { upb_Map_New(a, $key_upb_tag, $upb_tag) }
@@ -595,7 +595,7 @@
}
}
- fn get<'a>(m: RawMap, key: $key_t) -> Option<Self::Value<'a>> {
+ fn get<'msg>(m: RawMap, key: $key_t) -> Option<Self::Value<'msg>> {
let mut val = $msg_val($zero_val);
let found = unsafe {
upb_Map_Get(m, $key_msg_val(key), &mut val)
@@ -606,7 +606,7 @@
Some($from_msg_val(val))
}
- fn remove<'a>(m: RawMap, key: $key_t) -> bool {
+ fn remove(m: RawMap, key: $key_t) -> bool {
let mut val = $msg_val($zero_val);
unsafe {
upb_Map_Delete(m, $key_msg_val(key), &mut val)
@@ -629,11 +629,11 @@
};
}
-fn str_to_msg<'a>(val: impl Into<&'a ProtoStr>) -> upb_MessageValue {
+fn str_to_msg<'msg>(val: impl Into<&'msg ProtoStr>) -> upb_MessageValue {
upb_MessageValue { str_val: val.into().as_bytes().into() }
}
-fn msg_to_str<'a>(msg: upb_MessageValue) -> &'a ProtoStr {
+fn msg_to_str<'msg>(msg: upb_MessageValue) -> &'msg ProtoStr {
unsafe { ProtoStr::from_utf8_unchecked(msg.str_val.as_ref()) }
}
@@ -649,7 +649,7 @@
i64, i64, scalar_to_msg!(int64_val), scalar_from_msg!(int64_val), UpbCType::Int64, 0i64;
u64, u64, scalar_to_msg!(uint64_val), scalar_from_msg!(uint64_val), UpbCType::UInt64, 0u64;
bool, bool, scalar_to_msg!(bool_val), scalar_from_msg!(bool_val), UpbCType::Bool, false;
- ProtoStr, &'a ProtoStr, str_to_msg, msg_to_str, UpbCType::String, "";
+ ProtoStr, &'msg ProtoStr, str_to_msg, msg_to_str, UpbCType::String, "";
);
)*
}