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

Additional traits for std::mem::ManuallyDrop #44310

Merged
merged 2 commits into from
Sep 12, 2017
Merged

Conversation

ldr709
Copy link
Contributor

@ldr709 ldr709 commented Sep 4, 2017

The first commit adds Clone and Copy trait implementations for ManuallyDrop. Although Drop and Copy cannot be used together, this may be useful for generics.

The second commit adds implementations common traits. I do not think this is necessary, as they could be implemented in a wrapper type outside the standard library, but it would make ManuallyDrop more convenient to use.

Although types that don't implement Drop can't be Copyable, this can
still be useful when ManuallyDrop is used inside a generic type. This
doesn't derive from Copy as that would require T: Copy + Clone, instead
it provides an impl of Clone for T: Clone.
Add pass-through implementations for all of the derivable traits. These
cannot be derived since ManuallyDrop is a union.
@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 @BurntSushi (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.

@arielb1 arielb1 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 5, 2017
@carols10cents
Copy link
Member

ping @BurntSushi for review!

@BurntSushi
Copy link
Member

This seems fine to me, and I know I've been personally swayed in the past to add non-sensible impls in the name of generics since it seems rather harmless, but I'd still appreciate another set of eyes on this one. cc @rust-lang/libs

@BurntSushi BurntSushi added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2017
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Seems okay to me.

@alexcrichton
Copy link
Member

sgtm

@BurntSushi
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 11, 2017

📌 Commit 94301c4 has been approved by BurntSushi

@BurntSushi BurntSushi 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-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Sep 11, 2017
@bors
Copy link
Contributor

bors commented Sep 12, 2017

⌛ Testing commit 94301c4 with merge 8fc0fc8...

bors added a commit that referenced this pull request Sep 12, 2017
Additional traits for std::mem::ManuallyDrop

The first commit adds `Clone` and `Copy` trait implementations for `ManuallyDrop`. Although `Drop` and `Copy` cannot be used together, this may be useful for generics.

The second commit adds implementations common traits. I do not think this is necessary, as they could be implemented in a wrapper type outside the standard library, but it would make `ManuallyDrop` more convenient to use.
@bors
Copy link
Contributor

bors commented Sep 12, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: BurntSushi
Pushing 8fc0fc8 to master...

@bors bors merged commit 94301c4 into rust-lang:master Sep 12, 2017
@bluss bluss added the relnotes Marks issues that should be documented in the release notes of the next release. label Nov 16, 2017
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jan 4, 2018
Correct a few stability attributes

* The extra impls for `ManuallyDrop` were added in rust-lang#44310 which was only stabilised in 1.22.0.
* The impls for `SliceIndex` were stabilised in rust-lang#43373 but as `RangeInclusive` and `RangeToInclusive` are still unstable the impls should remain unstable.
* The `From` impls for atomic integers were added in rust-lang#45610 but most atomic integers are still unstable.
* The `shared_from_slice2` impls were added in rust-lang#45990 but they won't be stable until 1.24.0.
* The `Mutex` and `RwLock` impls were added in rust-lang#46082 but won't be stable until 1.24.0.
kennytm added a commit to kennytm/rust that referenced this pull request Jan 4, 2018
Correct a few stability attributes

* The extra impls for `ManuallyDrop` were added in rust-lang#44310 which was only stabilised in 1.22.0.
* The impls for `SliceIndex` were stabilised in rust-lang#43373 but as `RangeInclusive` and `RangeToInclusive` are still unstable the impls should remain unstable.
* The `From` impls for atomic integers were added in rust-lang#45610 but most atomic integers are still unstable.
* The `shared_from_slice2` impls were added in rust-lang#45990 but they won't be stable until 1.24.0.
* The `Mutex` and `RwLock` impls were added in rust-lang#46082 but won't be stable until 1.24.0.
kennytm added a commit to kennytm/rust that referenced this pull request Jan 5, 2018
Correct a few stability attributes

* The extra impls for `ManuallyDrop` were added in rust-lang#44310 which was only stabilised in 1.22.0.
* The impls for `SliceIndex` were stabilised in rust-lang#43373 but as `RangeInclusive` and `RangeToInclusive` are still unstable the impls should remain unstable.
* The `From` impls for atomic integers were added in rust-lang#45610 but most atomic integers are still unstable.
* The `shared_from_slice2` impls were added in rust-lang#45990 but they won't be stable until 1.24.0.
* The `Mutex` and `RwLock` impls were added in rust-lang#46082 but won't be stable until 1.24.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. 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.

9 participants