Skip to content

Rustdoc: Explain the copy trait more clearly (doc book) #25898

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

Merged
merged 2 commits into from
Jun 9, 2015
Merged

Rustdoc: Explain the copy trait more clearly (doc book) #25898

merged 2 commits into from
Jun 9, 2015

Conversation

azerupi
Copy link
Contributor

@azerupi azerupi commented May 30, 2015

As mentioned in #25893 the copy trait is not very well explained for beginners. There is no clear mention that all primitive types implement the copy trait and there are not a lot of examples.

With this change I try to make it more visible and understandable for new users.

I myself have struggled with this, see my question on stackoverflow. And I want to make it more transparent for others.

I filed issue #25893 but I thought that I could give it a shot myself to relieve some of the work from the devs :)

If it is not well written or there are some changes to be made before it can be merged, let me know.

Cheers,
Mathieu

As mentioned in #25893 the copy trait is not very well explained for beginners. There is no clear mention that all primitive types implement the copy trait and there are not a lot of examples. 

With this change I try to make it more visible and understandable for new users. 

I myself have struggled with this, see [my question on stackoverflow](http://stackoverflow.com/questions/30540419/why-are-booleans-copyable-even-though-the-documentation-doesnt-indicate-that). And I want to make it more transparent for others. 

I filed issue #25893 but I thought that I could give it a shot myself to relieve some of the work from the devs :)

If it is not well written or there are some changes to be made before it can be merged, let me know.

Cheers,
Mathieu
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (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. 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.

@azerupi azerupi changed the title Proposal to explain the copy trait more clearly Rustdoc: Explain the copy trait more clearly (doc book) May 30, 2015
@@ -156,6 +156,49 @@ that, just like a move, when we assign `v` to `v2`, a copy of the data is made.
But, unlike a move, we can still use `v` afterward. This is because an `i32`
has no pointers to data somewhere else, copying it is a full copy.

All primitive types implement the `Copy` trait and their ownership is
therefore not moved like one would assume, following the **ownership rules**.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've been using curly 's to indicate this, not bold

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean with curly's?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ', but and . See ‘use of moved value’ a bit farther up on the page

@alexcrichton
Copy link
Member

r? @steveklabnik

@rust-highfive rust-highfive assigned steveklabnik and unassigned brson Jun 1, 2015
@azerupi
Copy link
Contributor Author

azerupi commented Jun 8, 2015

@steveklabnik I updated with the asked changes, I hope all is good now :)

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 8, 2015

📌 Commit 5efdcf2 has been approved by steveklabnik

@steveklabnik
Copy link
Member

Thank you so much!

Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 9, 2015
As mentioned in rust-lang#25893 the copy trait is not very well explained for beginners. There is no clear mention that all primitive types implement the copy trait and there are not a lot of examples. 

With this change I try to make it more visible and understandable for new users. 

I myself have struggled with this, see [my question on stackoverflow](http://stackoverflow.com/questions/30540419/why-are-booleans-copyable-even-though-the-documentation-doesnt-indicate-that). And I want to make it more transparent for others. 

I filed issue rust-lang#25893 but I thought that I could give it a shot myself to relieve some of the work from the devs :)

If it is not well written or there are some changes to be made before it can be merged, let me know.

Cheers,
Mathieu
bors added a commit that referenced this pull request Jun 9, 2015
@bors bors merged commit 5efdcf2 into rust-lang:master Jun 9, 2015
@azerupi azerupi deleted the patch-3 branch June 30, 2015 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants