os-rust/library/core
Matthias Krüger 0db3932433
Rollup merge of #129938 - chancancode:patch-1, r=thomcc
Elaborate on deriving vs implementing `Copy`

I was reading this documentation and this wasn't immediately clear to me.

In my mind, it seemed obvious that a type can only claim to be `Copy` if the bits it is storing can be `Copy`, and in the case of a generic struct that can only be the case if `T: Copy`. So the bound added by the derive seemed necessary at all times, and I thought what the documentation was trying to say is that the custom implementation allows you to add _additional bounds_.

Of course what it was actually trying to point out is that just because you have a generic parameter `T`, it doesn't necessarily mean you are storing the bits of `T`. And if you aren't, it may be the case that your own bits can be copied regardless of whether the bits of `T` can be safely copied.

Thought it may be worth elaborating to make that a bit more clear. Haven't tested/didn't try to figure out how to render this locally. Mainly not sure if the `PhantomData` back link is going to just work or need some extra stuff, but I figured someone else probably could just tell.
2024-09-05 18:58:56 +02:00
..
benches Improve isqrt tests and add benchmarks 2024-08-28 23:06:54 -04:00
src Rollup merge of #129938 - chancancode:patch-1, r=thomcc 2024-09-05 18:58:56 +02:00
tests Stabilize waker_getters 2024-09-02 18:51:59 -06:00
Cargo.toml Port std library to RTEMS 2024-09-03 09:19:29 +02:00