Allow type aliases to be marked as Trivial.#325
Merged
dtolnay merged 4 commits intodtolnay:masterfrom Oct 4, 2020
Merged
Conversation
56b4228 to
95c5758
Compare
This change allows aliases: type Foo = bindgen::Bar; and C++ opaque types: type Foo; to declare that they're 'trivial' in the sense that: * They have trivial move constructors * They have no destructors and therefore may be passed and owned by value in Rust. A subsequent commit will add C++ static assertions. This commit is a BREAKING CHANGE as it requires existing ExternTypes to gain a new associated type
95c5758 to
d7f5bb9
Compare
Collaborator
Author
|
I've just read #308 and it looks like I should rebase on top of that, if you think it will land soon, as there's a lot of commonality. I also need to add some tests like that PR has done. |
dtolnay
approved these changes
Oct 4, 2020
Owner
dtolnay
left a comment
There was a problem hiding this comment.
Thank you, this is terrific.
I am going to follow up with some minor fixups (which I'll link here) but this is nicely done.
This was referenced Oct 4, 2020
Merged
Owner
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #313.
This is a breaking change as it requires all implementers of
ExternTypeto add another associated type. Defaults for associated types are an unstable feature, the compiler tells me. Perhaps we should avoid this by using a new trait,ExternTypeKind, instead.