Rollup merge of #129938 - chancancode:patch-1, r=thomcc · patricklam/verify-rust-std@e51a0bc (original) (raw)

Original file line number Diff line number Diff line change
@@ -288,8 +288,19 @@ marker_impls! {
288 288 /// }
289 289 /// ```
290 290 ///
291 -/// There is a small difference between the two: the `derive` strategy will also place a `Copy`
292 -/// bound on type parameters, which isn't always desired.
291 +/// There is a small difference between the two. The `derive` strategy will also place a `Copy`
292 +/// bound on type parameters:
293 +///
294 +/// ```
295 +/// #[derive(Clone)]
296 +/// struct MyStruct(T);
297 +///
298 +/// impl<T: Copy> Copy for MyStruct { }
299 +/// ```
300 +///
301 +/// This isn't always desired. For example, shared references (`&T`) can be copied regardless of
302 +/// whether `T` is `Copy`. Likewise, a generic struct containing markers such as [`PhantomData`]
303 +/// could potentially be duplicated with a bit-wise copy.
293 304 ///
294 305 /// ## What's the difference between `Copy` and `Clone`?
295 306 ///