Skip to content

Tracking issue for ManuallyDrop #40673

Closed
Closed
@alexcrichton

Description

@alexcrichton
Member

Tracking issue for rust-lang/rfcs#1860

I believe initially implemented at #40559

Activity

added
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
on Mar 20, 2017
Ericson2314

Ericson2314 commented on Mar 20, 2017

@Ericson2314
Contributor

I left a comment rust-lang/rfcs#1860 (comment) which slipped by FCP. The tl;dr is: this is fine for now in my book, but we should consider &move and improved Drop again prior to stabilization. I'd hope the popularity of this feature would be considered a +1 &move---a wholly nicer, if harder-to-implement, solution---rather than a -1 (with the reasoning that this trick is good enough so &move isn't needed).

SimonSapin

SimonSapin commented on May 19, 2017

@SimonSapin
Contributor

I’d like this to be stabilized. What’s the next step?

The only alternative that I know of is https://crates.io/crates/nodrop, which on stable Rust requires a combination of hacks that look fragile to me.

crumblingstatue

crumblingstatue commented on May 24, 2017

@crumblingstatue
Contributor

I am personally using this in a project, so I'm in favor of stabilizing a solution for specifying drop order, but I also don't want @Ericson2314's comment ignored before stabilizing this.

sfackler

sfackler commented on May 31, 2017

@sfackler
Member

I don't believe &move or a new Drop are anywhere near the horizon. It seems unreasonable to hold this API up indefinitely.

@rfcbot fcp merge

added
B-unstableBlocker: Implemented in the nightly compiler and unstable.
B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.
and removed
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
on May 31, 2017
rfcbot

rfcbot commented on May 31, 2017

@rfcbot
Collaborator

Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

dtolnay

dtolnay commented on Jun 7, 2017

@dtolnay
Member

I filed rust-lang/api-guidelines#93 to follow up with a justification of why we prefer into_inner(ManuallyDrop<T>) over into_inner(self).

@rfcbot reviewed

Ericson2314

Ericson2314 commented on Jun 7, 2017

@Ericson2314
Contributor

Fair enough, this can always be deprecated.

SimonSapin

SimonSapin commented on Jul 3, 2017

@SimonSapin
Contributor

@brson I think this is waiting on you :)

rfcbot

rfcbot commented on Jul 8, 2017

@rfcbot
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

3 remaining items

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Jul 22, 2017
bluss

bluss commented on Aug 5, 2017

@bluss
Member

Sorry if I have missed this somewhere — do we have a decision for how layout optimization handles things like Option<ManuallyDrop<&i32>>? I can see that right now, the inner value is not used for the discriminant.

SimonSapin

SimonSapin commented on Aug 6, 2017

@SimonSapin
Contributor

In the case of struct ArrayVec<A: Array> { length: usize, data: ManuallyDrop<A> } impl<T, N: usize> Array for [T; N] {…} (assuming integer generics, or with a macro to generate impls for a number of specific N values), it is important that e.g. Option<ArrayVec<[&i32; 16]>> does not use the nonzeroness of &i32 to represent the discriminant of Option because the &i32 items might be uninitialized.

Or, in other words, ArrayVec needs some way to inhibit propagation of enum layout optimizations, and ManuallyDrop could be it.

added a commit that references this issue on Aug 12, 2017
7e22e24
ldr709

ldr709 commented on Aug 27, 2017

@ldr709
Contributor

This is probably neither the right time nor place for this, but any plans to impl Copy? It may seem odd to do so, since Copy types can be dropped trivially, but this would be useful in situations where you don't know whether or not a type impls Copy.

Gankra

Gankra commented on Aug 28, 2017

@Gankra
Contributor

You can submit a PR to derive(Copy) and it will likely be accepted.

kjetilkjeka

kjetilkjeka commented on Nov 9, 2017

@kjetilkjeka
Contributor

When testing it seems like impl<T: Clone> for ManuallyDrop<T> works on nightly/beta, but not on stable. I can't seem to find the PR/issue tracking this, does anyone have a link? Do anyone know if this will this land for 1.21?

this is the test I'm referring to.

ldr709

ldr709 commented on Nov 16, 2017

@ldr709
Contributor

@kjetilkjeka Here is the PR. Rust 1.21 has already been released and it doesn't have it. According to this if it is in beta now it should be in 1.22 (maybe a few weeks?), but I don't know much about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@SimonSapin@Ericson2314@Gankra@sfackler

        Issue actions

          Tracking issue for ManuallyDrop · Issue #40673 · rust-lang/rust