Skip to content

Has unsafe_destructor landed? It's still needed. #22362

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
diwic opened this issue Feb 15, 2015 · 4 comments
Closed

Has unsafe_destructor landed? It's still needed. #22362

diwic opened this issue Feb 15, 2015 · 4 comments

Comments

@diwic
Copy link
Contributor

diwic commented Feb 15, 2015

According to rust-lang's latest blog post, the unsafe_destructor reform has landed, so I should not need to use unsafe_destructor. But still, with Rust nightly (2015-02-13 21:15:39) I still get an error for simple cases like this:

struct B<'a> {
   z: &'a str,
}

impl<'a> Drop for B<'a> {
   fn drop(&mut self) {
       println!("{}", self.z);
   }
}
@tomjakubowski
Copy link
Contributor

The blog post was a little misleading; the RFC landed but not the changes to the compiler.

The specific issue for removing #[unsafe_destructor] is #22196

@steveklabnik
Copy link
Member

This is what I thought, but wasn't sure. Thanks tom!

@pnkfelix
Copy link
Member

To be precise (and also accurate):

  • The analysis that supports the removal of #[unsafe_destructor] has landed in the compiler, and is applied to all destructors (including those that currently use the #[unsafe_destructor] attribute.
  • ... but ...
  • until we gain more confidence in the results, we are still requiring the use of the #[unsafe_destructor] attribute to implement Drop on generic types.

The is what #22196 is meant to convey, but I thought the phrase "but not the changes to the compiler" in @tomjakubowski's post above might be a little confusing to people, since the vast bulk of the necessary changes to the compiler have not only landed, but are also turned on!

@diwic
Copy link
Contributor Author

diwic commented Feb 17, 2015

Ok, that makes sense! Thanks for the clarification.

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

No branches or pull requests

4 participants