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

Get rid of drop flags in wrappers #12

Closed
Boddlnagg opened this issue Jul 15, 2016 · 5 comments
Closed

Get rid of drop flags in wrappers #12

Boddlnagg opened this issue Jul 15, 2016 · 5 comments

Comments

@Boddlnagg
Copy link
Collaborator

Both HString and ComPtr<T> should be pointer sized, since they are wrapping a pointer, but actually are bigger because of drop flags. This is a problem for arrays/slices, because an array of HSTRINGs should be transmutable to an array of HStrings, and the same for ComPtr (element-wise conversion would be too expensive). This is why we currently expose raw types for arrays.

One possibility is #[unsafe_no_drop_flag], but this would not work on stable. Waiting for rust-lang/rust#34398 should also resolve the issue.

@chris-morgan
Copy link

Nightly (0.12) has MIR turned on by default now and doesn’t add a drop flag to the type any more; hopefully there won’t be any major issues, and it’ll all stay with MIR enabled and no drop flags added when we get to 0.12 being released as stable.

I reckon only supporting nightly for the next few months is perfectly reasonable.

@Boddlnagg
Copy link
Collaborator Author

Thanks for your comment, @chris-morgan! However, the current nightly still has the embedded drop flag even if it's not used (https://is.gd/VsLXeK). I think this is because rust-lang/rust#34398 is not yet resolved.

I agree that the way to go is to just wait until this is done and then require nightly until it hits stable.

@Boddlnagg
Copy link
Collaborator Author

rust-lang/rust#35764 will finally remove the drop flags.

@Boddlnagg
Copy link
Collaborator Author

🎉 rust-lang/rust#35764 was merged! So we just need to wait for the next nightlies.

@Boddlnagg
Copy link
Collaborator Author

This now works correctly on recent nightlies, #23 adds tests for it which fail in the presence of dropflags.

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