Commit Graph

728 Commits

Author SHA1 Message Date
David Tolnay
887c8a2eb1
Merge pull request #192 from cchalmers/cpp-true
Add cpp flag to cc
2020-05-08 15:55:10 -07:00
David Tolnay
110df7dc21
Defer to link-cplusplus crate for linking a standard library 2020-05-08 13:09:56 -07:00
David Tolnay
96c351b5a8
Format with rustfmt 2020-04-14 2020-05-08 13:06:18 -07:00
Christopher Chalmers
d24563dd24 Add cpp flag to cc
This means that clang++ will be called instead of clang.
2020-05-08 20:39:10 +01:00
David Tolnay
878ab12a15
Release 0.3.1 2020-05-08 10:05:03 -07:00
David Tolnay
2429c6b0f6
Merge pull request #190 from dtolnay/id
Enable sharing a consistent Rust type across multiple FFI blocks
2020-05-08 02:36:06 -07:00
David Tolnay
ae4dedab55
Update build files of test suite 2020-05-08 02:23:10 -07:00
David Tolnay
094db3ecea
Document ExternType trait 2020-05-08 02:06:30 -07:00
David Tolnay
a62cca2268
Add a use of type alias to test suite 2020-05-07 23:20:06 -07:00
David Tolnay
2b821e60e0
Don't do trait impls for non-local types 2020-05-07 23:18:09 -07:00
David Tolnay
e5a015a2b4
Allow type alias as a method receiver 2020-05-07 21:54:31 -07:00
David Tolnay
83fe0f06d5
Preserve a better span for type id mismatch errors 2020-05-07 20:14:49 -07:00
David Tolnay
c6ba2d27f4
Condense type ids rendered by rustc 2020-05-07 19:46:02 -07:00
David Tolnay
9f07303af1
Add ui test of type_id mismatch 2020-05-07 19:46:02 -07:00
David Tolnay
5f9e8ca1a0
Type alias code generation 2020-05-07 19:46:02 -07:00
David Tolnay
379d342779
Type alias type info 2020-05-07 19:46:02 -07:00
David Tolnay
3118fa6606
Type alias ident checking 2020-05-07 19:46:02 -07:00
David Tolnay
e2f9ec4c89
Type alias parsing 2020-05-07 19:46:02 -07:00
David Tolnay
e47119ca2f
Pull in syn 1.0.19
Includes https://github.com/dtolnay/syn/pull/790 which we need for
extern type aliases.
2020-05-07 19:46:02 -07:00
David Tolnay
9938381aa7
Introduce type aliases in syntax tree 2020-05-07 19:46:02 -07:00
David Tolnay
d09e012608
Add a type-level encoding of qualified paths 2020-05-07 19:46:01 -07:00
David Tolnay
db08d4affe
Pull in quote 1.0.4
Includes https://github.com/dtolnay/quote/pull/151 which will be used in
the implementation of type_id.
2020-05-07 19:46:01 -07:00
David Tolnay
6e80833572
Support code generation for multiple cxx::bridge files in one Build 2020-05-07 19:44:11 -07:00
David Tolnay
295ef6b38a
Adjust foreign item parsing to prepare for type aliases
This will be required for parse_extern_type to return a different kind
of Api for the case of type aliases.
2020-05-07 16:10:30 -07:00
David Tolnay
29061ea1d8
Update build status badge to GitHub Actions 2020-05-05 13:56:54 -07:00
David Tolnay
9531334f5a
Move github funding.yml out of repo root 2020-05-05 12:54:15 -07:00
David Tolnay
dfbce4bbc5
Remove unreachable return case from cxx function shim
This is unreachable because returning a CxxVector by value is not
allowed.

    error[cxxbridge]: returning C++ vector by value is not supported
       ┌─ lib.rs:30:29
       │
    30 │     fn not_allowed() -> CxxVector<u8>;
       │                         ^^^^^^^^^^^^^ returning C++ vector by value is not supported
       │
2020-05-05 10:52:12 -07:00
David Tolnay
4301f3ca51
Simplify discriminant overflow check 2020-05-05 10:29:52 -07:00
David Tolnay
a3f6407efa
Expand discriminant overflow error message
Renders as:

    error[cxxbridge]: discriminant overflow on value after 4294967295
       ┌─ src/main.rs:11:9
       │
    11 │         B,
       │         ^ discriminant overflow
       │
       = note: explicitly set `= 0` if that is desired outcome

This more closely matches rustc's error message, which is:

    error[E0370]: enum discriminant overflowed
     --> src/lib.rs:4:5
      |
    4 |     B,
      |     ^ overflowed on value after 255
      |
      = note: explicitly set `B = 0` if that is desired outcome
2020-05-05 10:28:00 -07:00
David Tolnay
884d91f0bc
Resolve absurd_extreme_comparisons lint 2020-05-05 10:17:23 -07:00
David Tolnay
db450b0a9d
Suppress some lints in cxx-build 2020-05-05 10:16:57 -07:00
David Tolnay
c79ba750b0
Suppress len_without_is_empty lint 2020-05-05 10:13:00 -07:00
David Tolnay
39ee0ed36b
Resolve assign_op_pattern lint 2020-05-05 10:12:29 -07:00
David Tolnay
7ae018fb5a
Resolve redundant_field_names lint 2020-05-05 10:11:30 -07:00
David Tolnay
acc64cb201
Merge pull request #189 from jgalenson/enums
Compute enum discriminant during parsing
2020-05-05 10:09:16 -07:00
Joel Galenson
8ef1bc809c Fix rustc 1.42.0. 2020-05-05 08:45:49 -07:00
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