-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Conversation
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. |
There was a problem hiding this comment.
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.
@@ -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. |
There was a problem hiding this comment.
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.
Thanks, documenting these properly is a big improvement to docs. The readers had to guess what Default would do previously |
Thanks for the suggestions. Will push the changes soon. |
41881e8
to
49e77db
Compare
@bors r+ |
📌 Commit 41881e8 has been approved by |
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/a/an
@bors: r=bluss rollup (Also, thank you so much for this PR!) |
📌 Commit 5798003 has been approved by |
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
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