Commit Graph

728 Commits

Author SHA1 Message Date
David Tolnay
7bc2edd734
Include conflicting name in duplicate name error message 2020-05-04 00:41:53 -07:00
David Tolnay
83496ebf33
Move error reporting span computation to tokens.rs 2020-05-04 00:36:53 -07:00
David Tolnay
d932041745
Catch function name collisions 2020-05-04 00:31:56 -07:00
David Tolnay
ab91445c1d
Check type name duplication more compactly 2020-05-04 00:31:28 -07:00
David Tolnay
96a826b8f0
Check function signature restrictions in a more appropriate place 2020-05-04 00:17:12 -07:00
David Tolnay
2c61f66ecd
Merge pull request #185 from dtolnay/actions
Enable GitHub Actions
2020-05-02 21:34:42 -07:00
David Tolnay
193ce8171a
Enable GitHub Actions 2020-05-02 21:20:14 -07:00
David Tolnay
0d366c754b
Remove CI badge from Cargo.toml
Support for badges has been deprecated by crates.io.
2020-05-01 20:51:38 -07:00
David Tolnay
b3f66461cd
Update past yanked version of proc-macro2
1.0.11 was yanked.
2020-05-01 17:29:12 -07:00
David Tolnay
7bdd9b51db
Merge pull request #184 from dtolnay/fallback
Support building C++ code generator with panic=abort
2020-05-01 16:16:23 -07:00
David Tolnay
761a5fc7fd
Support building C++ code generator with panic=abort 2020-05-01 16:02:02 -07:00
David Tolnay
18cd757213
Merge pull request #182 from jgalenson/enums
Expose the enum value to Rust as a field
2020-05-01 14:26:15 -07:00
Joel Galenson
db1ec31283 Expose the enum value to Rust as a field 2020-05-01 14:00:48 -07:00
David Tolnay
e720e852c1
Merge pull request #181 from dtolnay/sort
Sort errors reported by line number
2020-05-01 10:35:45 -07:00
David Tolnay
1ba09e1422
Sort errors reported by line number 2020-05-01 10:14:41 -07:00
David Tolnay
8adb223f3e
Restore support for rustc 1.42 2020-05-01 10:14:27 -07:00
David Tolnay
57d81a12fb
Merge pull request #180 from jgalenson/enums
Properly handle enum discriminant overflows.
2020-05-01 10:13:24 -07:00
Joel Galenson
04fa0967e2 Properly handle enum discriminant overflows.
This both checks for enum values that are illegal due to overflow and
ensures we do not overflow on valid enums.
2020-05-01 10:00:31 -07:00
David Tolnay
c4ddb4d172
Add tests for by-value-not-supported errors 2020-05-01 10:00:17 -07:00
David Tolnay
b3fcf7b724
Fix warning about get_unchecked returning a C-incompatible reference
out/tests/ffi/lib.rs.cc:1011:22: warning: 'cxxbridge03$std$vector$tests$Shared$get_unchecked' has C-linkage specified, but returns user-defined type 'const tests::Shared &' which is incompatible with C [-Wreturn-type-c-linkage]
    const tests::Shared &cxxbridge03$std$vector$tests$Shared$get_unchecked(const ::std::vector<tests::Shared> &s, size_t pos) noexcept {
                         ^
    out/tests/ffi/lib.rs.cc:1038:17: warning: 'cxxbridge03$std$vector$tests$C$get_unchecked' has C-linkage specified, but returns user-defined type 'const tests::C &' which is incompatible with C [-Wreturn-type-c-linkage]
    const tests::C &cxxbridge03$std$vector$tests$C$get_unchecked(const ::std::vector<tests::C> &s, size_t pos) noexcept {
                    ^
    2 warnings generated.
2020-04-30 22:58:31 -07:00
David Tolnay
6b6423edfb
Really check everything in check_all 2020-04-30 22:55:23 -07:00
David Tolnay
a83301ce5b
Update ident checker's error reporting to match type checker's 2020-04-30 22:55:23 -07:00
David Tolnay
9dcb8339f0
Do not abort parser on namespace ident checks 2020-04-30 22:55:23 -07:00
David Tolnay
63f92e8283
Preserve Span of namespace segments 2020-04-30 22:55:23 -07:00
David Tolnay
4037de267a
Use a better constant string idiom in test 2020-04-30 22:51:51 -07:00
David Tolnay
f5aeea2e4c
Touch up a variable name in vector test 2020-04-30 22:51:51 -07:00
David Tolnay
9beba146b7
Avoid relying on ADL for std::back_inserter 2020-04-30 22:51:50 -07:00
David Tolnay
d7984c2b7f
Touch up PR 170 2020-04-30 22:50:10 -07:00
David Tolnay
02d58bb593
Merge pull request #170 from jgalenson/enums
Support C-style enums
2020-04-30 22:49:50 -07:00
David Tolnay
2b12b32113
Update PR 170 compiletests at nightly rustc 2020-04-30 22:03:25 -07:00
Joel Galenson
c03402aee5 Support C-style enums
This adds support for passing C-style enums between Rust and C++.

We use the Rust representation for enums suggested by dtolnay in #132.
Note that as this does not use real enums, Rust code cannot treat them
as normal enums, e.g., by converting them to integers.  But common
uses such as pattern matching remain unchanged.
2020-04-30 14:12:37 -07:00
David Tolnay
d776519a75
Merge pull request #169 from dtolnay/vecbool
Add support for rust::Vec<bool>
2020-04-30 08:55:43 -07:00
David Tolnay
f336b3b343
Add support for rust::Vec<bool> 2020-04-30 08:45:54 -07:00
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 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 7f635f360e.
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