-
Notifications
You must be signed in to change notification settings - Fork 337
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
Vector fixes #148
Merged
Vector fixes #148
Conversation
This file contains 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
The vector support needs to be covered by our test suite, but it doesn't need to be featured to this extent in our intro code.
It's possible for `std` to mean something different from `::std` if the user's ffi mod contains a type named `std`.
A vector whose element type is highly aligned need not itself be highly aligned. If C++ passed in a reference to a vector which is less aligned than its element type, and Rust thought vectors were more highly aligned then they really are, then that would have been undefined behavior.
This autotrait impl is already inferred.
I assume VectorTarget was copied from the naming of UniquePtrTarget, but pointers have a "target" (i.e. Deref<Target = T>) while vectors have an "element".
We only implement VectorElement for sized types anyway.
Vectors have elements, not targets. Pointers have targets.
The previous logic incorrectly accepted Atoms outside the intended set, and also emitted duplicate errors for opaque C++ types.
These will need to diverge shortly; in particular we'd like to support Rust vectors containing Rust strings and C++ vectors containing C++ strings.
Without this, on some compilers: src/cxx.cc:252:30: error: specialization of ‘template<class T> rust::cxxbridge02::Vec<T>::Vec()’ in different namespace [-fpermissive] rust::Vec<CXX_TYPE>::Vec() noexcept { ^ src/cxx.cc:274:3: note: in expansion of macro ‘RUST_VEC_OPS’ MACRO(u8, uint8_t) ^ src/cxx.cc:295:1: note: in expansion of macro ‘FOR_EACH_SIZED_PRIMITIVE’ FOR_EACH_SIZED_PRIMITIVE(RUST_VEC_OPS) ^ In file included from src/cxx.cc:1:0: include/cxx.h:216:3: error: from definition of ‘template<class T> rust::cxxbridge02::Vec<T>::Vec()’ [-fpermissive] Vec() noexcept; ^
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.
This is a followup to #67 to get the std::vector and std::vec::Vec bindings in better shape.