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

Compile union feature on 1.50 via ManuallyDrop?

Closed
saethlin opened this issue Dec 30, 2020 · 2 comments
Closed

Compile union feature on 1.50 via ManuallyDrop? #247

saethlin opened this issue Dec 30, 2020 · 2 comments

Comments

@saethlin
Copy link
Contributor

saethlin commented Dec 30, 2020

On the 1.50 beta if I delete the cfg_attr for feature = "union", I get this error message:

error[E0658]: unions with non-`Copy` fields other than `ManuallyDrop<T>` are unstable
   --> src/lib.rs:354:5
    |
354 |     inline: MaybeUninit<A>,
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #55149 <https://github.com/rust-lang/rust/issues/55149> for more information

It doesn't take a lot to make the 1.50 (currently beta) compiler accept the code, but I'm a bit out of my depth here. Can we have the union feature on stable starting in 1.50?

@mbrubeck
Copy link
Contributor

mbrubeck commented Dec 30, 2020

Yes, it looks like this works! Please feel free to submit a pull request if you have a version that compiles already. (Or I can do it, if you prefer.) You can also change the documentation comment at the top of src/lib.rs to say that the union feature requires Rust 1.50.

bors-servo added a commit that referenced this issue Dec 31, 2020
Wrap with ManuallyDrop so that the union feature works on 1.50

Per #247 (comment)

The unrelated diff was produced by rustfmt, which my editor runs automatically. I'm a bit surprised, usually when this produces a diff it's a big one. Do you want me to revert those lines?
@saethlin
Copy link
Contributor Author

saethlin commented Dec 31, 2020

Closing, PR addressing this was merged

@mbrubeck mbrubeck mentioned this issue Dec 31, 2020
bors-servo added a commit that referenced this issue Dec 31, 2020
Version 1.6.0

Release notes:

* The `union` feature is now compatible with stable Rust 1.49 (#248, #247).
* Fixed warnings when compiling with Rust 1.51 nightly (#242, #246).
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

2 participants