Commit Graph

542 Commits

Author SHA1 Message Date
Joel Galenson
8854773c56 Compute enum discriminant during parsing
This allows us to reuse the computation in multiple places later.
2020-05-05 08:32:32 -07:00
David Tolnay
de471c9a22
Merge pull request #187 from jgalenson/enums
Support enums defined in C++ code.
2020-05-04 20:49:52 -07:00
Joel Galenson
9fe5ea3ad7 Add missing message. 2020-05-04 20:25:15 -07:00
Joel Galenson
0f654ffeb0 Fix previous commit. 2020-05-04 20:04:21 -07:00
Joel Galenson
905eb2e1f5 Support enums defined in C++ code.
This allows listing an enum in an extern "C" block as well as in the
shared block.  In this case, we do not emit the C++ declaration of the
enum but instead emit static assertions that it has the values that we
expect.
2020-05-04 15:02:17 -07:00
David Tolnay
24d22b471a
Remove Travis configuration 2020-05-04 02:31:53 -07:00
David Tolnay
29bc177103
Merge pull request #186 from dtolnay/batch
Batch parse errors
2020-05-04 01:40:45 -07:00
David Tolnay
4c14162d34
Update multi parse errors ui test 2020-05-04 01:30:09 -07:00
David Tolnay
5275978d13
Batch errors from the parser 2020-05-04 01:29:17 -07:00
David Tolnay
cbf3f03ff2
Demarcate the infallible majority of expand.rs 2020-05-04 01:29:17 -07:00
David Tolnay
0dd85ff5f7
Move error collection one level out of type checker 2020-05-04 01:29:17 -07:00
David Tolnay
df344a82d9
Extract error collection to be not specific to check.rs 2020-05-04 01:29:16 -07:00
David Tolnay
15a6c76352
Add test of invocation with multiple parse errors 2020-05-04 01:29:01 -07:00
David Tolnay
2ec14632c0
Be consistent about certain variable names always meaning a reference 2020-05-04 00:53:12 -07:00
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