Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates Clone docs for Copy comparison. #86200

Merged
merged 1 commit into from
Jun 16, 2021

Conversation

qwerty01
Copy link
Contributor

Quite a few people (myself included) have come under the impression that the difference between Copy and Clone is that Copy is cheap and Clone is expensive, where the actual difference is that Copy constrains the type to bit-wise copying, and Clone allows for more expensive operations. The source of this misconception is in the Clone docs, where the following line is in the description:

Differs from Copy in that Copy is implicit and extremely inexpensive, while Clone is always explicit and may or may not be expensive.

The Clone documentation page also comes up before the Copy page on google when searching for "the difference between Clone and Copy".

This PR updates the documentation to clarify that "extremely inexpensive" means an "inexpensive bit-wise copy" to hopefully prevent future rust users from falling into this misunderstanding.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 10, 2021
@JohnTitor
Copy link
Member

Makes sense to me, thanks!
r? @JohnTitor @bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 16, 2021

📌 Commit 2788c71 has been approved by JohnTitor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 16, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 16, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#85283 (Avoid possible filename collision in coverage tests)
 - rust-lang#86200 (Updates `Clone` docs for `Copy` comparison.)
 - rust-lang#86209 (fix minor wording/typo issues in core::option docs)
 - rust-lang#86242 (rustdoc- dont ICE on `ConstEvaluatable` predicates)
 - rust-lang#86280 (Add a regression test for issue-76510)
 - rust-lang#86293 (Allow to run only a few GUI tests)
 - rust-lang#86327 (Don't mark "safe" intrinsics as unsafe)
 - rust-lang#86345 (Remove some duplicate `char` assoc items on RELEASES.md)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ceb706 into rust-lang:master Jun 16, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants