111 Commits

Author SHA1 Message Date
David Tolnay
85db248625
Test returning unique_ptr<string> from Rust to C++ 2020-03-06 16:26:46 -08:00
David Tolnay
2fe58c670c
Declare test suite helpers noexcept 2020-03-06 16:23:09 -08:00
David Tolnay
4b3a66edf1
Implement returning unique_ptr from Rust to C++ 2020-03-06 16:22:14 -08:00
David Tolnay
5cd8d61f9d
Implement returning Box from Rust to C++ 2020-03-06 16:18:44 -08:00
David Tolnay
a7d00e8281
Test &R passed from Rust to C++ 2020-03-06 15:53:33 -08:00
David Tolnay
be13d8ad2c
Test Box returned from C++ to Rust 2020-03-06 15:50:24 -08:00
David Tolnay
09011c304b
Fix alignment of by-value returns from Rust 2020-03-06 14:46:46 -08:00
David Tolnay
f51447e2b9
Implement moving ownership of struct arguments to Rust 2020-03-06 14:22:00 -08:00
David Tolnay
33169bdd59
Safe to assume more about the Box representation
https://doc.rust-lang.org/std/boxed/index.html:
So long as T: Sized, a Box<T> is guaranteed to be represented as a
single pointer and is also ABI-compatible with C pointers (i.e. the C
type T*).
2020-03-06 13:10:58 -08:00
David Tolnay
9c68b1a0c6
Lazily compute include set 2020-03-06 11:27:29 -08:00
David Tolnay
cc3767f0ed
Format with rustfmt 2019-10-07 2020-03-06 10:42:02 -08:00
David Tolnay
a46a237fe7
Make passing String by value to C++ const 2020-03-06 10:28:15 -08:00
David Tolnay
d1e2efc847
Begin to introduce Rust-style move for C++ objects 2020-03-06 10:25:50 -08:00
David Tolnay
a52602b8af
Use PartialEq<Atom> for some ident comparisons 2020-03-06 10:24:34 -08:00
David Tolnay
438e26034c
Make PartialEq work with reference lhs 2020-03-06 10:21:35 -08:00
David Tolnay
ba5eb2de8c
Add PartialEq impls for comparison against specific atoms 2020-03-06 10:15:52 -08:00
David Tolnay
39d575fb04
Separate the two uses of expand_extern_arg
These are going to need to diverge shortly. Indirect args can pass from
Rust to C++ as *const T from which C++ will do an unsafe ptr::read, but
need to pass from C++ to Rust as *mut T to leave a zero value in the old
location for when the C++ destructor runs.
2020-03-03 12:47:43 -08:00
David Tolnay
40226ab58a
Implement passing ownership of string to Rust 2020-03-03 00:05:35 -08:00
David Tolnay
6c089108e4
Remove prefix from mangled string symbols 2020-03-02 00:23:05 -08:00
David Tolnay
4590d2af81
Delete unused get_raw member from Box 2020-03-02 00:03:25 -08:00
David Tolnay
851677c4cc
Remove insignificant parameter names from header 2020-03-01 23:49:46 -08:00
David Tolnay
2248c3064e
Write Box internals in terms of type aliases 2020-03-01 21:13:32 -08:00
David Tolnay
9f9213709d
Backport type aliases to c++11 2020-03-01 21:09:40 -08:00
David Tolnay
f6292378c7
Add rust::Box member type aliases 2020-03-01 21:09:11 -08:00
David Tolnay
d9c4ac955f
Organize string constructors 2020-03-01 20:36:21 -08:00
David Tolnay
133d9d5d9d
Merge pull request #56 from dtolnay/cast
Change cast operators to explicit
2020-03-01 20:36:12 -08:00
David Tolnay
baae443ae2
Change Str to Repr operator to explicit 2020-03-01 20:20:10 -08:00
David Tolnay
404d689e95
Change string cast operators to explicit 2020-03-01 20:19:41 -08:00
David Tolnay
83a5a11b9a
Merge pull request #55 from dtolnay/iosfwd
Use iosfwd for forward declared ostream insertion operators
2020-03-01 20:18:37 -08:00
David Tolnay
001102af71
Use iosfwd for forward declared ostream insertion operators 2020-03-01 20:05:04 -08:00
David Tolnay
9081beb1a0
Remove redundant prefix from mangled Box related symbols 2020-03-01 19:52:09 -08:00
David Tolnay
da2b904530
Merge pull request #50 from dtolnay/snake
Expose snake case type aliases
2020-03-01 14:42:19 -08:00
David Tolnay
92d12f3993
Revert "Demonstrate that snake case type aliases work"
This reverts commit c2db0e83f2e5745276a76c16a82750b9369d6e29.
2020-03-01 14:13:50 -08:00
David Tolnay
c2db0e83f2
Demonstrate that snake case type aliases work 2020-03-01 14:09:19 -08:00
David Tolnay
3b0c988059
Expose snake case type aliases 2020-03-01 14:08:57 -08:00
David Tolnay
9ad1fbc478
Pass ending comment to end_block
Clang-format doesn't always like the same ending comment as the start of
the block. In particular it wants:

    inline namespace cxxbridge01 {
      ...
    } // namespace cxxbridge01
2020-03-01 14:05:01 -08:00
David Tolnay
69fe4c25ec
Format with clang-format 2020-03-01 14:05:01 -08:00
David Tolnay
e3bd6abf48
Merge pull request #48 from dtolnay/namespace
Better use of namespaces
2020-03-01 14:00:40 -08:00
David Tolnay
aa17a5acbb
Rename example's namespace to org::example 2020-03-01 13:47:29 -08:00
David Tolnay
750755e557
Rename namespace to rust::inline cxxbridge01 2020-03-01 13:47:29 -08:00
David Tolnay
324437a263
Rename C++ RustBox to Box 2020-03-01 13:47:29 -08:00
David Tolnay
09dbe75a5d
Rename C++ RustStr to Str 2020-03-01 13:47:28 -08:00
David Tolnay
5608216979
Rename C++ RustString to String 2020-03-01 13:47:28 -08:00
David Tolnay
d944446b98
Merge pull request #47 from dtolnay/nested
Support nested blocks in C++ emitter
2020-03-01 13:47:19 -08:00
David Tolnay
b92e66f4dc
Support nested blocks in C++ emitter 2020-03-01 13:37:15 -08:00
David Tolnay
7e219b8099
Use absolute qualified identifiers in generated C++
This avoids collision with the user's namespaces having the same name.

Less important in the context of the current names right now, but more
important after we move our public C++ API from cxxbridge:: to rust::.
In fact our example code already uses org::rust:: as the namespace,
inside of which a non-absolute rust:: would cause trouble.
2020-03-01 13:14:55 -08:00
David Tolnay
e976487440
Update third-party deps to drop rustversion 2020-03-01 12:49:21 -08:00
David Tolnay
649337e12d
Move namespace alias to top of header for visibility 2020-02-25 18:11:20 -08:00
David Tolnay
63576d458d
Move build -> tools/bazel
Fixes https://github.com/dtolnay/cxx/issues/45.
2020-02-25 00:13:25 -08:00
David Tolnay
089e479b22
Run buildifier to resort after hyphen conversion 2020-02-25 00:12:50 -08:00