Skip to content

Commit

Permalink
Rollup merge of #122201 - coolreader18:doc-clone_from, r=dtolnay
Browse files Browse the repository at this point in the history
Document overrides of `clone_from()` in core/std

As mentioned in rust-lang/rust#96979 (comment)

Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source".

I reused some of the wording over and over for similar impls, but I'm not sure that the wording is actually *good*. Would appreciate feedback about that.

Also, now some of these seem to provide pretty specific guarantees about behavior (e.g. will reuse the exact same allocation iff the len is the same), but I was basing it off of the docs for [`Box::clone_from`](https://doc.rust-lang.org/1.75.0/std/boxed/struct.Box.html#method.clone_from-1) - I'm not sure if providing those strong guarantees is actually good or not.
  • Loading branch information
matthiaskrgr authored Apr 17, 2024
2 parents da90fc5 + 0953611 commit fe448f5
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit fe448f5

Please sign in to comment.