Move the info about perfect derive to shared.rs

PiperOrigin-RevId: 590702727
pull/15079/head
Alyssa Haroldsen 12 months ago committed by Copybara-Service
parent 7c38dabce3
commit c2532d5f17
  1. 3
      rust/cpp.rs
  2. 5
      rust/shared.rs

@ -229,9 +229,6 @@ impl<'msg, T: ?Sized> RepeatedField<'msg, T> {
}
}
// These use manual impls instead of derives to avoid unnecessary bounds on `T`.
// This problem is referred to as "perfect derive".
// https://smallcultfollowing.com/babysteps/blog/2022/04/12/implied-bounds-and-perfect-derive/
impl<'msg, T: ?Sized> Copy for RepeatedField<'msg, T> {}
impl<'msg, T: ?Sized> Clone for RepeatedField<'msg, T> {
fn clone(&self) -> RepeatedField<'msg, T> {

@ -13,6 +13,11 @@
use std::fmt;
// There are a number of manual `Debug` and similar impls instead of using their
// derives, in order to to avoid unnecessary bounds on a generic `T`.
// This problem is referred to as "perfect derive".
// https://smallcultfollowing.com/babysteps/blog/2022/04/12/implied-bounds-and-perfect-derive/
/// Everything in `__public` is re-exported in `protobuf.rs`.
/// These are the items protobuf users can access directly.
#[doc(hidden)]

Loading…
Cancel
Save