-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implements Default for mutable slices. Fixes: #29244 #29245
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (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. |
@@ -655,6 +655,12 @@ impl<'a, T> Default for &'a [T] { | |||
fn default() -> &'a [T] { &[] } | |||
} | |||
|
|||
#[stable(feature = "rust1", since = "1.5.0")] | |||
impl<'a, T> Default for &'a mut [T] { | |||
#[stable(feature = "rust1", since = "1.5.0")] |
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.
I don't believe the method itself needs/desires the annotation (you can't partially-stabley implement a trait). The fact that the &[T]
impl does is basically cargo-culting because these annotations are useless today.
@petrochenkov can probably best speak to what the heck the "right" thing is here, though.
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.
Yeah the methods on a trait impl don't need these annotations, and can you also rename the "rust1" feature to something like "mut_slice_default"? Currently we require that a feature name is all stabilized within the same "since".
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.
@alexcrichton done, noted and amended. Thanks!
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.
@gankro As @alexcrichton said, although we don't need it - we have mut_slice_default
instead.
No description provided.