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

Documentation of what Default does for each type #36396

Merged
merged 3 commits into from Sep 14, 2016

Conversation

athulappadan
Copy link
Contributor

Addresses #36265
I haven't changed the following types due to doubts:

1)src/libstd/ffi/c_str.rs
2)src/libcore/iter/sources.rs
3)src/libcore/hash/mod.rs
4)src/libcore/hash/mod.rs
5)src/librustc/middle/privacy.rs

r? @steveklabnik

@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 @steveklabnik (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.

@@ -249,6 +249,7 @@ impl<'a, B: ?Sized> Default for Cow<'a, B>
where B: ToOwned,
<B as ToOwned>::Owned: Default
{
/// Creates a `Cow<'a, B>` pointer.
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong. Cow is not a pointer either. Default for Cow is

Creates an owned Cow<'a, B> with the default value for the contained owned value.

or something.

@bluss bluss changed the title Documentation of what does for each type Documentation of what Default does for each type Sep 11, 2016
@@ -117,6 +118,7 @@ pub struct AtomicPtr<T> {
#[cfg(target_has_atomic = "ptr")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for AtomicPtr<T> {
/// Creates an `AtomicPtr<T>` with an initial mutable null pointer.
Copy link
Member

Choose a reason for hiding this comment

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

Mutability is irrelevant here.

Creates a null AtomicPtr<T>

might be better and more concise.

@bluss
Copy link
Member

bluss commented Sep 11, 2016

Thanks, documenting these properly is a big improvement to docs. The readers had to guess what Default would do previously

@athulappadan
Copy link
Contributor Author

Thanks for the suggestions. Will push the changes soon.

@bluss
Copy link
Member

bluss commented Sep 12, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Sep 12, 2016

📌 Commit 41881e8 has been approved by bluss

@bluss
Copy link
Member

bluss commented Sep 12, 2016

@bors rollup

@@ -674,6 +674,7 @@ impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet<T> {

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Default for BTreeSet<T> {
/// Makes a empty `BTreeSet<T>` with a reasonable choice of B.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/a/an

@steveklabnik
Copy link
Member

@bors: r=bluss rollup

(Also, thank you so much for this PR!)

@bors
Copy link
Contributor

bors commented Sep 14, 2016

📌 Commit 5798003 has been approved by bluss

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 14, 2016
Documentation of what Default does for each type

Addresses rust-lang#36265
I haven't changed the following types due to doubts:

1)src/libstd/ffi/c_str.rs
2)src/libcore/iter/sources.rs
3)src/libcore/hash/mod.rs
4)src/libcore/hash/mod.rs
5)src/librustc/middle/privacy.rs

r? @steveklabnik
@bors bors merged commit 5798003 into rust-lang:master Sep 14, 2016
@athulappadan athulappadan deleted the Default-docs branch September 19, 2016 04:02
@athulappadan athulappadan restored the Default-docs branch November 4, 2016 09:53
@athulappadan athulappadan deleted the Default-docs branch November 4, 2016 09:53
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.

None yet

7 participants