Skip to content

Emit PhantomData<UnsafeCell<T>> members for all generic parameters #689

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

Merged
merged 1 commit into from
May 5, 2017

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented May 5, 2017

This makes generated generic structs lifetime invariant, since we cannot know
the C++ type's true variance.

Fixes #506

Rebased + squashed version of #635; cc @Kowasaki

To resolve the conflicts and rebase and squash, I did essentially these commands:

$ git fetch servo
$ git checkout -b Kowasaki-master servo/master
$ git merge --squash --edit Kowasaki/master
$ cargo test
$ cd tests/expectations
$ cargo test
$ cd -
$ git commit --author="Kowasaki"
$ git push fitzgen Kowasaki-master

Hopefully that is useful for you in the future :) Thanks for fixing this issue!

This makes generated generic structs lifetime invariant, since we cannot know
the C++ type's true variance.

Fixes rust-lang#506
@highfive
Copy link

highfive commented May 5, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@fitzgen
Copy link
Member Author

fitzgen commented May 5, 2017

@bors-servo r+

@bors-servo
Copy link

📌 Commit c779297 has been approved by fitzgen

@bors-servo
Copy link

⌛ Testing commit c779297 with merge 3eb8f70...

bors-servo pushed a commit that referenced this pull request May 5, 2017
Emit `PhantomData<UnsafeCell<T>>` members for all generic parameters

This makes generated generic structs lifetime invariant, since we cannot know
the C++ type's true variance.

Fixes #506

Rebased + squashed version of #635; cc @Kowasaki

To resolve the conflicts and rebase and squash, I did essentially these commands:

```
$ git fetch servo
$ git checkout -b Kowasaki-master servo/master
$ git merge --squash --edit Kowasaki/master
$ cargo test
$ cd tests/expectations
$ cargo test
$ cd -
$ git commit --author="Kowasaki"
$ git push fitzgen Kowasaki-master
```

Hopefully that is useful for you in the future :) Thanks for fixing this issue!
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: fitzgen
Pushing 3eb8f70 to master...

@bors-servo bors-servo merged commit c779297 into rust-lang:master May 5, 2017
@fitzgen fitzgen deleted the Kowasaki-master branch May 5, 2017 18:38
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.

Generate PhantomData<UnsafeCell<T>> to make generic FFI structs lifetime invariant
4 participants