638 Commits

Author SHA1 Message Date
David Tolnay
9846d08d40
Merge pull request #206 from dtolnay/include
Move all function implementations to the bottom of cxx.h
2020-05-12 20:59:17 -07:00
David Tolnay
2a2b9ad1f5
Move implementation details to the bottom of cxx.h 2020-05-12 20:43:20 -07:00
David Tolnay
e54f338188
Support multiple cxx.h header sections for the same guard 2020-05-12 20:43:20 -07:00
David Tolnay
1385ca42b2
Add missing noexcept on Vec<T>::const_iterator methods 2020-05-12 20:15:20 -07:00
David Tolnay
8c54eeca6c
Add missing noexcept on a Slice constructor 2020-05-12 20:08:20 -07:00
David Tolnay
32ee9d3676
rust::Vec has a bitcopy constructor too 2020-05-12 20:01:15 -07:00
David Tolnay
6aa34e4240
Release 0.3.3 0.3.3 2020-05-11 20:56:51 -07:00
David Tolnay
cf22385662
Document c++ standard support 2020-05-11 20:50:59 -07:00
David Tolnay
0e078f74be
Add release notes link to crate-level rustdoc 2020-05-11 20:50:03 -07:00
David Tolnay
2b93b55560
Merge pull request #203 from dtolnay/unique
Switch demo code to using std::make_unique
2020-05-11 20:48:12 -07:00
David Tolnay
4ab952da41
Merge pull request #202 from dtolnay/stdflag
Add cargo cfgs for opt in to newer standards
2020-05-11 20:43:35 -07:00
David Tolnay
c13ad23d9c
Switch demo code to using std::make_unique 2020-05-11 20:38:19 -07:00
David Tolnay
9808ef177c
Add cargo cfgs for opt in to newer standards
Currently unused, but will be needed when integrating std::optional or
std::string_view support.

    [dependencies]
    cxx = { version = "0.3", features = ["c++17"] }
2020-05-11 20:30:44 -07:00
David Tolnay
14db1e2049
Merge pull request #201 from dtolnay/include
Parse include!(<path/to/bracketed>)
2020-05-11 20:14:45 -07:00
David Tolnay
cf96664b29
Test include parsing 2020-05-11 20:07:34 -07:00
David Tolnay
91e87fa51e
Parse include!(<path/to/bracketed>)
For example:

    #[cxx::bridge]
    mod ffi {
        extern "C" {
            include!("path/to/quoted");
            include!(<path/to/bracketed>);

            ...
        }
    }

Emitted as:

    #include "path/to/quoted"
    #include <path/to/bracketed>
2020-05-11 20:07:34 -07:00
David Tolnay
8918451412
Pull in syn 1.0.20 for Macro::parse_body fix
https://github.com/dtolnay/syn/pull/791

This will give better error message in the upcoming implementation of
include!(<bracketed/path/to>).
2020-05-11 20:05:56 -07:00
David Tolnay
bbcf2154e6
Accept bracketed in addition to quoted extra includes
Invoked as:

    cxxbridge path/to/file.rs -i '<path/to/bracketed>' -i path/to/quoted

Emits:

    #include <path/to/bracketed>
    #include "path/to/quoted"
2020-05-11 19:04:25 -07:00
David Tolnay
7fbfc95720
Merge pull request #198 from dtolnay/icons
Add crosslink icons to top of rustdoc
2020-05-11 13:35:11 -07:00
David Tolnay
e3daefbf63
Add crosslink icons to top of rustdoc 2020-05-11 13:27:04 -07:00
David Tolnay
43f3aee48d
Merge pull request #200 from dtolnay/bazel
Fix permission denied failure in bazel CI job
2020-05-11 13:26:45 -07:00
David Tolnay
f5ac0d9ffa
Fix permission denied failure in bazel CI job
This job started failing in GitHub Actions with this error:

    ## $ bazel run demo-rs --verbose_failures --noshow_progress
    Downloading https://releases.bazel.build/3.1.0/release/bazel-3.1.0-linux-x86_64...
    could not run Bazel: could not start Bazel: fork/exec /home/runner/work/cxx/cxx/tools/bazel: permission denied
    ##[error]Process completed with exit code 1.
2020-05-11 13:19:14 -07:00
David Tolnay
dbe7cb0721
Merge pull request #197 from dtolnay/find
Find cxx::bridge mod nested inside another mod
2020-05-11 01:20:00 -07:00
David Tolnay
2498af39f2
Find cxx::bridge mod nested inside another mod 2020-05-11 01:13:33 -07:00
David Tolnay
b4dba23910
Bring gen module doc up to date 2020-05-11 00:55:40 -07:00
David Tolnay
2967b66788
Move finding of bridge mod to its own module 2020-05-11 00:53:06 -07:00
David Tolnay
65bc8e6af8
Detect earlier untyped discriminants out of bounds of later suffix 2020-05-11 00:30:24 -07:00
David Tolnay
9f7c55acde
Rename discriminant Bounds to Limits
This is aligned with "limits" as used in std::numeric_limits in C++.
2020-05-11 00:19:02 -07:00
David Tolnay
8155e58ba1
Treat unexpected tokens in repr attribute as unexpected repr 2020-05-11 00:15:12 -07:00
David Tolnay
a954fcadde
Merge pull request #196 from dtolnay/enum
Choose enum discriminant type based on repr attributes, suffixes, values
2020-05-11 00:14:44 -07:00
David Tolnay
17451dea34
Restore rust 1.42 compatibility 2020-05-10 23:49:12 -07:00
David Tolnay
f6a89f2813
Respect inferred enum repr in C++ code generator 2020-05-10 23:45:51 -07:00
David Tolnay
c605e6fa61
Respect inferred enum repr in Rust code generator 2020-05-10 23:37:12 -07:00
David Tolnay
560661abe5
Test unsatisfiable discriminant range 2020-05-10 23:32:31 -07:00
David Tolnay
b24f52e289
Test inconsistent suffix on enum discriminants 2020-05-10 23:29:12 -07:00
David Tolnay
f85431239d
Test discriminant outside of the repr's bounds 2020-05-10 23:28:04 -07:00
David Tolnay
f2d584101d
Expand maximum recognized discriminant to 64 bits 2020-05-10 23:23:37 -07:00
David Tolnay
94cce00fdd
Detect mismatched suffix on discriminant values 2020-05-10 23:19:39 -07:00
David Tolnay
5966f7b3f6
Detect out of bounds when inserting discriminant 2020-05-10 22:59:56 -07:00
David Tolnay
ddf69e291b
Parse repr attribute on enums 2020-05-10 22:57:33 -07:00
David Tolnay
0435a81842
Recover from some enum parsing errors 2020-05-10 22:57:33 -07:00
David Tolnay
e2e303f7f2
Infer enum repr based on discriminant range 2020-05-10 22:57:32 -07:00
David Tolnay
f1715fa994
Add const bound data for various discriminant reprs 2020-05-10 22:57:32 -07:00
David Tolnay
9bcb4c6d0b
Extract integer suffix of discriminants as the repr 2020-05-10 22:57:32 -07:00
David Tolnay
2b8bf6d262
Preserve the original discriminant Expr 2020-05-10 22:57:32 -07:00
David Tolnay
69c7960cb2
Parse negative discriminants 2020-05-10 22:57:32 -07:00
David Tolnay
17e137fbb3
Factor out a discriminant processing library 2020-05-10 22:57:32 -07:00
David Tolnay
699351bc78
Display for Atom 2020-05-10 22:57:08 -07:00
David Tolnay
a4596c4455
Expose Atom str for use in error messages 2020-05-10 22:55:45 -07:00
David Tolnay
64703b4207
Give Derive enum and impls their own module 2020-05-10 22:12:33 -07:00