Technically these methods fail either if the field is primitive (non-message) or if the field is repeated. However it is confusing to have a repeated message field claim to be of type 'message' and then fail with an error message that claims you need a message type.
PiperOrigin-RevId: 693789370
Some uses put the `inline` keyword before the attribute, some put it after the
attribute, some didn't put it at all.
Clang is very permissive and it allowed code to work where it breaks in other
compilers. GCC doesn't like if you don't put the keyword, MSVC doesn't like if
the keyword is in the wrong place.
By moving the keyword into the macro we prevent this issue altogether.
PiperOrigin-RevId: 693469310
This CL deletes the per-message C++ functions for operating on repeated fields
and replaces them with functions in the runtime that can work with arbitrary
messages.
Similar to what we did with maps, this required refactoring the code to make it
work with `RepeatedPtrFieldBase`, the untyped base class of
`RepeatedPtrField<T>`. I added a `RustRepeatedMessageHelper` class to allow us
access to the protected methods we need.
This should save a bit of linker input code size, but I think more importantly
we are going to need this eventually to enable tree shaking to work well.
PiperOrigin-RevId: 693394959
EnableIfHpbClass was too restrictive in the past; it was
toggled only if <T> was extended. This has been rectified
to toggle if T extends T::Access, which reflects the
true intention.
PiperOrigin-RevId: 693368653
I noticed that the use of `unsafe` here was not really necessary, so I tweaked
the code to remove it. If we avoid using `__unstable_leak_raw_message()` then
we don't need to unsafely create a `NonNull`.
PiperOrigin-RevId: 693357956