Commit Graph

2774 Commits

Author SHA1 Message Date
David Tolnay
affcc4e8e9
Merge pull request #1114 from dtolnay/failstring
Allow trycatch to call Fail using std::string
2022-10-15 15:08:28 -07:00
David Tolnay
6f257d81f4
Allow trycatch to call Fail using std::string 2022-10-15 15:00:44 -07:00
David Tolnay
031723f9cb
Merge pull request #1113 from dtolnay/exception
Fix incorrect string len if an exception's message is invalid UTF-8
2022-10-15 15:00:36 -07:00
David Tolnay
438621c641
Fix incorrect string len if an exception's message is invalid UTF-8 2022-10-15 14:53:07 -07:00
David Tolnay
a39652409c
Merge pull request #1112 from dtolnay/fail
Factor out the Fail lambda from all trycatch calls
2022-10-15 14:27:24 -07:00
David Tolnay
d1afb26f4b
Factor out the Fail lambda from all trycatch calls 2022-10-15 14:17:26 -07:00
David Tolnay
5ab0a485cc
Mark cxxbridge1$exception noexcept
This function is implemented in Rust using #[no_mangle] extern "C", and
it cannot throw a C++ exception.
2022-10-15 14:14:12 -07:00
David Tolnay
202a02917b
Move namespace rust::repr above namespace rust::detail
I'd like to use rust::repr::PtrLen in the implementation of a
rust::detail::Fail functor.
2022-10-15 13:57:49 -07:00
David Tolnay
41f662f02e
Deduplicate rust::repr namespace begin/end 2022-10-15 13:57:00 -07:00
David Tolnay
1b33345a6e
Move rust::repr out of anonymous namespace
This will be needed to use PtrLen in the implementation of a Fail
functor in cxx.cc.
2022-10-15 13:54:08 -07:00
David Tolnay
eae0477484
Format C++ with clang-format 14.0.0 2022-10-15 13:10:54 -07:00
David Tolnay
746a369c6b
Merge pull request #1111 from lopopolo/patch-1
Update codespan-reporting to build with -Zminimal-versions
2022-10-13 21:44:10 -07:00
Ryan Lopopolo
845f66a245
Update codespan-reporting to build with -Zminimal-versions
`codespan-reporting` 0.11.0 does not build with `-Zminimal-versions` because it has a constraint
 on `termcolor = 1` whereas it depends on the `Copy` trait being implemented on types in `termcolor`
which were not added until 1.0.4.

See:

- https://github.com/brendanzab/codespan/issues/322
- e99c867339
2022-10-13 21:24:43 -07:00
David Tolnay
1171d3592b
Merge pull request #1109 from dtolnay/output
Switch from set-output to $GITHUB_OUTPUT
2022-10-13 09:46:40 -07:00
David Tolnay
5b38fbf0c6
Switch from set-output to $GITHUB_OUTPUT 2022-10-13 09:38:11 -07:00
David Tolnay
5af33efc41
Ui test changes for trybuild 1.0.66 2022-10-04 22:21:07 -07:00
David Tolnay
b43a2341a9
Lockfile update 2022-10-04 22:20:54 -07:00
David Tolnay
5782254472
Update ui test suite to nightly-2022-10-05 2022-10-04 21:28:00 -07:00
David Tolnay
2b154a4233
Update ui test suite to nightly-2022-09-29 2022-09-28 21:36:28 -07:00
David Tolnay
d2a7e0b244
Release 1.0.78 2022-09-28 16:45:12 -07:00
David Tolnay
49df9e3572
Merge pull request #1105 from dtolnay/clap
Update argument parser to clap 4
2022-09-28 16:44:25 -07:00
David Tolnay
fae939d974
Update argument parser to clap 4 2022-09-28 16:38:15 -07:00
David Tolnay
00406ecc3a
Raise minimum tested toolchain to rust 1.60 2022-09-28 16:31:59 -07:00
David Tolnay
554032aa11
Lockfile update 2022-09-28 16:03:31 -07:00
David Tolnay
3e3c664c84
Sort cxxbridge flags in alphabetical order 2022-09-28 16:03:09 -07:00
David Tolnay
be7090ab22
Release 1.0.77 2022-09-27 17:53:26 -07:00
David Tolnay
ad19ee0963
Lockfile update 2022-09-27 17:52:13 -07:00
David Tolnay
c2179d3eb5
Merge pull request #1104 from dtolnay/vecbool
Allow Vec<bool>
2022-09-27 17:50:51 -07:00
David Tolnay
f142a6e330
Test return value of vec return functions 2022-09-27 17:41:34 -07:00
David Tolnay
b122cff91d
Allow Vec<bool> to pass syntax check 2022-09-27 17:38:47 -07:00
David Tolnay
f24ccb0dce
Add test of C++ returning Rust Vec
This is currently rejected.

    error[cxxbridge]: unsupported element type of Vec
        ┌─ lib.rs:121:40
        │
    121 │         fn c_return_rust_vec_bool() -> Vec<bool>;
        │                                        ^^^^^^^^^ unsupported element type of Vec
2022-09-27 17:38:27 -07:00
David Tolnay
35f4b680f2
Update ui test suite to nightly-2022-09-27 2022-09-26 22:00:21 -07:00
David Tolnay
f014282770
Exclude buck-out from being watched by watchman 2022-09-21 09:01:49 -07:00
David Tolnay
8931be52a0
Raise minimum tested toolchain to rust 1.56.1
Required by the transitive dev-dependency on once_cell.

    error: failed to parse manifest at github.com-1ecc6299db9ec823/once_cell-1.15.0/Cargo.toml

    Caused by:
      feature `edition2021` is required

      The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23)).
      Consider trying a newer version of Cargo (this may require the nightly release).
      See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.
2022-09-20 22:38:04 -07:00
David Tolnay
4e96c36aac
Release 1.0.76 2022-09-19 10:36:53 -07:00
David Tolnay
6e25fbc313
Lockfile update 2022-09-19 10:35:59 -07:00
David Tolnay
f2aecb0ae5
Merge pull request #1099 from dtolnay/vecarray
Allow Rust vector of array of trivially relocatable type
2022-09-19 10:33:54 -07:00
David Tolnay
072fd4f0a3
Allow Rust vector of array of trivially relocatable type 2022-09-19 10:25:31 -07:00
David Tolnay
83075824a4
Remove default package.readme metadata from Cargo.toml
Since cargo 1.46.0, README.md is recognized by default.
2022-09-14 09:15:58 -07:00
David Tolnay
b6e97c824d
Update ui test suite to nightly-2022-09-07 2022-09-06 23:58:47 -07:00
David Tolnay
ed1852df1f
Merge pull request #1093 from dtolnay/jsonexample
Fix missing <string> include in std::string example
2022-09-02 21:13:22 -07:00
David Tolnay
96606d570e
Fix missing <string> include in std::string example
The previous code works in _some_ STL implementations, namely if
_either_ of the following is true:

    1. At least one of the other four STL headers included by json.h
       transitively includes <string>, as opposed to just <stringfwd.h>; or

    2. The way std::variant is implemented does not require knowing the
       inner types' type traits when just naming the std::variant
       without yet instantiating any of its member function templates.

On other STL implementations in which neither of the above is true, this
example failed to build with an error such as:

    In file included from target/debug/build/example-d2d484e0c793273c/out/cxxbridge/sources/example/src/main.rs.cc:1:
    In file included from target/debug/build/example-d2d484e0c793273c/out/cxxbridge/crate/example/include/json.h:2:
    In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/map:60:
    In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:63:
    In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_algobase.h:64:
    In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_pair.h:59:
    In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/move.h:57:
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/type_traits:1339:23: error: implicit instantiation of undefined template 'std::basic_string<char>'
                        __bool_constant<__has_trivial_destructor(_Tp)>>
                                        ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/type_traits:3214:5: note: in instantiation of template class 'std::is_trivially_destructible<std::basic_string<char>>' requested here
        is_trivially_destructible<_Tp>::value;
        ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:299:5: note: in instantiation of variable template specialization 'std::is_trivially_destructible_v<std::basic_string<char>>' requested here
              (is_trivially_destructible_v<_Types> && ...);
               ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:308:4: note: in instantiation of static data member 'std::__detail::__variant::_Traits<std::monostate, double, std::basic_string<char>, std::vector<json>, std::map<std::basic_string<char>, json>>::_S_trivial_dtor' requested here
              _S_trivial_dtor && _S_trivial_move_ctor
              ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:689:45: note: in instantiation of static data member 'std::__detail::__variant::_Traits<std::monostate, double, std::basic_string<char>, std::vector<json>, std::map<std::basic_string<char>, json>>::_S_trivial_move_assign' requested here
          _Move_assign_base<_Traits<_Types...>::_S_trivial_move_assign, _Types...>;
                                                ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:692:28: note: in instantiation of template type alias '_Move_assign_alias' requested here
        struct _Variant_base : _Move_assign_alias<_Types...>
                               ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:1318:15: note: in instantiation of template class 'std::__detail::__variant::_Variant_base<std::monostate, double, std::basic_string<char>, std::vector<json>, std::map<std::basic_string<char>, json>>' requested here
        : private __detail::__variant::_Variant_base<_Types...>,
                  ^
    target/debug/build/example-d2d484e0c793273c/out/cxxbridge/crate/example/include/json.h:33:63: note: in instantiation of template class 'std::variant<std::monostate, double, std::basic_string<char>, std::vector<json>, std::map<std::basic_string<char>, json>>' requested here
      std::variant<std::monostate, number, string, array, object> value;
                                                                  ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stringfwd.h:74:11: note: template is declared here
        class basic_string;
              ^
2022-09-02 21:04:02 -07:00
David Tolnay
851716f7e9
GitHub Workflows security hardening 2022-09-02 15:09:28 -07:00
David Tolnay
0293ff50cf
Release 1.0.75 2022-09-02 14:33:59 -07:00
David Tolnay
bd8907bf42
Lockfile update 2022-09-02 14:28:56 -07:00
David Tolnay
ce7c5c467b
Make SharedPtr Unpin like UniquePtr 2022-09-02 14:27:26 -07:00
David Tolnay
a14eb80ced
Move Unpin impl near Drop impl
These traits are closely related. The meaning of Pin<P> when P isn't
Unpin is that in between when P ends up in the pin and when P's Drop
impl begins running, it must not be moved. Moving before the pin, or
moving from within drop once the Drop impl is in progress, are fine.
2022-09-02 14:23:29 -07:00
David Tolnay
9a84aa559f
Touch up UniquePtr Unpin explanation 2022-09-02 14:22:08 -07:00
David Tolnay
c59c685f61
Merge pull request #1091 from LeonMatthesKDAB/unpin-uniqueptr
Add Unpin impl for UniquePtr.
2022-09-02 14:20:29 -07:00
Leon Matthes
f4ae0f1dfd Add Unpin impl for UniquePtr.
Similar to a std::boxed::Box, a UniquePtr itself can be Unpin, even if
its target is not Unpin.
As UniquePtr is not a self-referential type, this is safe to do.

See:
- https://doc.rust-lang.org/std/pin/index.html#unpin
- https://doc.rust-lang.org/std/boxed/struct.Box.html#impl-Unpin
2022-09-02 10:13:21 +02:00