495 Commits

Author SHA1 Message Date
David Tolnay
7997d07818
Avoid second lib.rs in the same src directory
This was throwing off the Bazel build because it didn't know which one
to make the crate root.
2020-04-30 07:55:08 -07:00
David Tolnay
4ee9ecabbd
Re-enable Buck CI 2020-04-30 07:48:25 -07:00
David Tolnay
3c90cd2ef8
Move Rust symbols required by C++ to a separate Buck target
Closes #168.
2020-04-30 07:45:34 -07:00
David Tolnay
74dd379f09
Format PR 157 with clang-format 2020-04-30 07:45:24 -07:00
David Tolnay
a5ca1164b7
Pin bazel CI to stable 1.43.0 2020-04-29 22:03:27 -07:00
David Tolnay
63a4384af7
Release 0.3.0 0.3.0 2020-04-29 18:57:39 -07:00
David Tolnay
cc9ece5186
Document the line that needs to go in build-dependencies 2020-04-29 18:57:05 -07:00
David Tolnay
c1d23a07ff
Lockfile update 2020-04-29 18:51:55 -07:00
David Tolnay
6960162922
Bump namespace to cxxbridge03 2020-04-29 18:49:50 -07:00
David Tolnay
b4714a7b52
Merge pull request #167 from dtolnay/split
Split cxx runtime and build components
2020-04-29 18:43:29 -07:00
David Tolnay
171412c036
Disable Buck build 2020-04-29 18:32:09 -07:00
David Tolnay
f8ed07327b
Split cxx runtime and build components 2020-04-29 18:23:14 -07:00
David Tolnay
1f56702490
Set binary name for buck-built codegen cli 2020-04-29 16:38:36 -07:00
David Tolnay
6ba5ccf4c3
Remove cargo author var from BUCK target
This was made unnecessary by 7f635f360e279d3c3a00f78a8911cca32d90991a.
2020-04-29 16:33:19 -07:00
myronahn
da9be50ad8
Add all std::iterator_traits required types to const_iterator of rust::Vec<T> (#157)
https://en.cppreference.com/w/cpp/iterator/iterator_traits

`std::iterator_traits` requires the following 5 types:

- `difference_type` - a signed integer type that can be used to identify distance between iterators
- `value_type` - the type of the values that can be obtained by dereferencing the iterator. This type is void for output iterators.
- `pointer` - defines a pointer to the type iterated over (value_type)
- `reference` - defines a reference to the type iterated over (value_type)
- `iterator_category` - the category of the iterator. Must be one of iterator category tags.

The current `const_iterator` for `rust::Vec<T>` only defined `value_type` and `reference` which caused an error when using `std::copy` on gcc 7.5.0 on Ubuntu but seemed to work fine on MacOS.
2020-04-28 15:47:23 -07:00
David Tolnay
776fd8953d
Generalize reference-to-reference check to cover all positions
Checking this in check_type_ref allows it to apply anywhere that a
reference is written, such as return position which was not covered by
the previous logic.
2020-04-28 13:38:28 -07:00
David Tolnay
f6a7167ea9
Merge pull request #162 from jgalenson/refref
Disallow passing a reference to a reference.
2020-04-28 12:32:01 -07:00
Joel Galenson
2bd1312f2f Disallow passing a reference to a reference. 2020-04-28 10:14:41 -07:00
David Tolnay
a53c90f08a
Merge pull request #160 from dtolnay/relnotes
Link to release notes from readme
2020-04-27 18:21:52 -07:00
David Tolnay
5d08baa8ae
Link to release notes from readme 2020-04-27 18:12:08 -07:00
David Tolnay
4fc533190a
Release 0.2.12 0.2.12 2020-04-27 17:10:39 -07:00
David Tolnay
4f3b6fd2e9
Lockfile update 2020-04-27 17:10:12 -07:00
David Tolnay
378ca50c4c
Format PR 159 with clang-format 2020-04-27 16:47:55 -07:00
David Tolnay
d6c521916f
Merge pull request #159 from jgalenson/underscore
Allow wildcard argument names.
2020-04-27 16:46:22 -07:00
Joel Galenson
ba67607fa2 Allow wildcard argument names.
This adds support for wildcard variable names by internally giving
them unique names.
2020-04-27 16:00:50 -07:00
David Tolnay
bd22ce57dd
Space out travis matrix
One big chunk of yaml with entries of varying length was annoying to
skim.
2020-04-26 09:06:52 -07:00
David Tolnay
e948983427
Ignore BUILD files under target directory
After doing a `cargo publish` or `cargo package` we were getting a BUILD
file at target/package/cxx-0.2.11/BUILD which was subsequently picked up
by `bazel build ...`.
2020-04-25 19:50:45 -07:00
David Tolnay
52509840c7
Replace thiserror dependency with handwritten impls
A dependency wasn't carrying its weight for just two Error impls.
2020-04-25 19:46:49 -07:00
David Tolnay
7b4e657015
Release 0.2.11 0.2.11 2020-04-25 19:33:35 -07:00
David Tolnay
ad959f6f23
Lockfile update 2020-04-25 19:32:39 -07:00
David Tolnay
8d06f5b588
Remove CxxVector::push_back for now
I'd like to give some more thought to how to expose this. Taking the
value by reference and copying it into the vector is nice when T is an
opaque C++ type but otherwise a pretty weird API from Rust.
2020-04-25 19:17:42 -07:00
David Tolnay
8b6ffa6ab1
Fix mutability of push_back trait method 2020-04-25 19:17:17 -07:00
David Tolnay
a8df0943f5
Document pass-by-value restriction of CxxVector 2020-04-25 19:08:40 -07:00
David Tolnay
47ee894a66
Merge pull request #148 from dtolnay/vec
Vector fixes
2020-04-25 18:26:54 -07:00
David Tolnay
1768d8fd07
Specialize only within the same namespace
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;
       ^
2020-04-25 18:15:14 -07:00
David Tolnay
83c69e92f7
Test Rust Vec in Rust signatures 2020-04-25 18:02:19 -07:00
David Tolnay
f97c2d51ed
Add construction and assignment for rust::Vec 2020-04-25 18:02:19 -07:00
David Tolnay
313b10ed1e
Add const bitcopy constructor for Vec 2020-04-25 18:02:19 -07:00
David Tolnay
d2ce8a997b
Fix and test passing Vec by value from Rust to C 2020-04-25 18:02:19 -07:00
David Tolnay
7798969827
Fix and test returning Vec by reference from C to Rust 2020-04-25 18:02:19 -07:00
David Tolnay
8b9d176ea7
Fix and test fallible return of Vec from C to Rust 2020-04-25 18:02:19 -07:00
David Tolnay
03dca70161
Fix Vec returns by value 2020-04-25 18:02:18 -07:00
David Tolnay
e6d5021522
Fix expansion of Rust Vec in extern signatures 2020-04-25 18:02:18 -07:00
David Tolnay
b41e74c152
Test returning Vec by value from C to Rust 2020-04-25 18:02:18 -07:00
David Tolnay
fa85fce853
Clarify mentions of C++ vector in error messages 2020-04-25 18:02:18 -07:00
David Tolnay
e70303c68e
Disallow passing CxxVector by move 2020-04-25 18:02:18 -07:00
David Tolnay
51cc8ee061
Fix module path of Vec in generated Rust code 2020-04-25 18:02:18 -07:00
David Tolnay
99c93d864c
Add vector types to reserved names list 2020-04-25 18:02:18 -07:00
David Tolnay
de5340ec85
Test returning CxxVector by reference from C to Rust 2020-04-25 18:02:18 -07:00
David Tolnay
2244d1f553
Test passing CxxVector by reference from Rust to C 2020-04-25 18:02:17 -07:00