Skip to content

Add ManuallyDrop lang item for precise control of destructors #19822

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

Closed
wants to merge 1 commit into from

Conversation

gereeter
Copy link
Contributor

ManuallyDrop { value: value }
}

/// Gets a mutable pointer to the wrapped value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Presumably this should be on get_mut, which actually doesn't seem to be implemented?

@huonw
Copy link
Member

huonw commented Dec 14, 2014

I would prefer the RFC get feedback from other core team members before we land that design. (I'm not putting any effort into pushing the RFC forward atm because it seems totally optional for 1.0.)

@gereeter
Copy link
Contributor Author

I agree that it would be nice to get more feedback on the RFC and I understand that this isn't necessary for 1.0. However:

  • The RFC has received nothing but positive responses.
  • The RFC has been open and waiting for comments for several months.
  • The change involved is tiny (3 lines to the compiler) and should have no adverse side effects.
  • I keep running in to situations in which I have to fall back to heap allocation because I don't have access to ManuallyDrop. The specific instance that prompted this PR was me trying to optimize BTreeMap's iterators to render Add intrusive iterators to BTree. #19796 unnecessary and needing ManuallyDrop to avoid allocation during iteration. I'd really like to avoid having extra functions like intrusive iterators in 1.0 Rust, especially not marked #[stable], unless there is no good way to optimize the idiomatic alternatives.
  • I'm only exposing ManuallyDrop under core, not std.
  • All parts of ManuallyDrop are marked #[experimental].

@Gankra
Copy link
Contributor

Gankra commented Jan 2, 2015

RFC hasn't moved and nothing has been happening here. Closing due to inactivity; sorry 😢

@Gankra Gankra closed this Jan 2, 2015
@gereeter gereeter deleted the manually-drop branch December 17, 2015 01:30
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.

3 participants