1784 Commits

Author SHA1 Message Date
David Tolnay
4429a9e50c
Merge pull request #581 from dtolnay/exactsize
Make CxxVector's iterator an ExactSizeIterator
2020-12-13 16:20:52 -08:00
David Tolnay
0f3d3b542e
Set iterator size hint for OrderedSet iteration 2020-12-13 16:08:19 -08:00
David Tolnay
724ac7581e
Make CxxVector's iterator an ExactSizeIterator 2020-12-13 16:08:19 -08:00
David Tolnay
ab3238ca8d
Release 1.0.18 1.0.18 2020-12-13 16:02:02 -08:00
David Tolnay
9b7f3dfe11
Merge pull request #580 from dtolnay/vector
Expose public vector module
2020-12-12 23:51:46 -08:00
David Tolnay
b5d039c448
Expose public vector module 2020-12-12 23:29:53 -08:00
David Tolnay
d854ea03fd
Merge pull request #579 from dtolnay/module
Shorten name of string and vector modules
2020-12-12 23:24:33 -08:00
David Tolnay
bac25829d1
Shorten name of string and vector modules 2020-12-12 23:14:01 -08:00
David Tolnay
be3cbf7694
Use integer standard library types from std namespace
The implementation is not required to define these types in the global
namespace.
2020-12-12 22:16:01 -08:00
David Tolnay
08679aeae2
Include cstddef for std::ptrdiff_t in iterator difference_type 2020-12-12 22:10:01 -08:00
David Tolnay
74dd66f781
Import sys/types.h for ssize_t
Previously the header file generated for the following bridge did not
compile.

    #[cxx::bridge]
    mod ffi {
        struct S {
            x: isize,
        }
    }

    example-ecfac19134395bcc/out/cxxbridge/sources/example/src/main.rs.cc:15:15: error: ‘ssize_t’ does not name a type
       15 | using isize = ssize_t;
          |               ^~~~~~~
    example-ecfac19134395bcc/out/cxxbridge/sources/example/src/main.rs.cc:26:11: error: ‘isize’ in namespace ‘rust’ does not name a type
       26 |   ::rust::isize x;
          |           ^~~~~
2020-12-12 22:03:58 -08:00
David Tolnay
1e784a3487
Add aliases for the Rust numeric primitives 2020-12-12 21:34:52 -08:00
David Tolnay
8192e1b848
Merge pull request #576 from dtolnay/size_t
Document and static assert assumptions on size_t layout
2020-12-12 21:31:13 -08:00
David Tolnay
03c43f56f0
Document and static assert assumptions on size_t size 2020-12-12 21:11:16 -08:00
David Tolnay
2e637d96d1
Format with clang-format 10 2020-12-12 21:08:01 -08:00
David Tolnay
5f702bbc84
Express Slice documentation using concepts requires clause 2020-12-12 17:15:44 -08:00
David Tolnay
439ed0b91a
Remove unneeded self check in Box<T>::operator=
As long as T's operator= correctly handles self assignment, this logic
is correct without the additional check.
2020-12-12 17:01:06 -08:00
David Tolnay
448624173c
Merge pull request #574 from dtolnay/box
Free Box allocation on T constructor exception
2020-12-12 16:52:20 -08:00
David Tolnay
f448e20075
Hide raw alloc/dealloc functions 2020-12-12 16:42:45 -08:00
David Tolnay
e7d662d51d
Free Box allocation on T constructor exception 2020-12-12 16:38:22 -08:00
David Tolnay
e5703162e8
Move Box alloc/dealloc functions to guard object 2020-12-12 16:31:01 -08:00
David Tolnay
25b3c1d1e2
Add dealloc shim for Box to dealloc without running T's Drop 2020-12-12 16:29:34 -08:00
David Tolnay
4bd77b65df
Merge pull request #573 from dtolnay/box
Add Box construction tests
2020-12-12 16:29:20 -08:00
David Tolnay
a141674f56
Add Box construction tests 2020-12-12 16:21:24 -08:00
David Tolnay
0f1ac8b3fd
Merge pull request #572 from dtolnay/box
Fix uninitialized Drop on exception in rust::Box<T>::in_place
2020-12-12 15:50:45 -08:00
David Tolnay
c5dc45a0b3
Fix uninitialized Drop on exception in rust::Box<T>::in_place 2020-12-12 15:44:46 -08:00
David Tolnay
6f18248fe4
Merge pull request #571 from dtolnay/box
Delete private Box default constructor
2020-12-12 15:44:32 -08:00
David Tolnay
c4b3422dee
Delete private Box default constructor 2020-12-12 15:24:52 -08:00
David Tolnay
faf22e8112
Release 1.0.17 1.0.17 2020-12-12 09:59:02 -08:00
David Tolnay
8693392e58
Merge pull request #569 from dtolnay/typename
Fix omitted typenames incompatible with Visual C++ 2015
2020-12-12 08:57:07 -08:00
David Tolnay
665178e914
Fix omitted typenames incompatible with Visual C++ 2015 2020-12-12 08:50:07 -08:00
David Tolnay
38f6fe2d37
Release 1.0.16 1.0.16 2020-12-11 14:13:18 -08:00
David Tolnay
a42c638efe
Merge pull request #566 from dtolnay/vec-copy
Add Vec copy constructor and copy assignment operator
2020-12-11 14:12:32 -08:00
David Tolnay
dd42c72287
Add Vec copy assignment operator 2020-12-11 14:05:26 -08:00
David Tolnay
9007e46b03
Add Vec copy constructor 2020-12-11 14:05:12 -08:00
David Tolnay
381d9530d4
Merge pull request 565 from dtolnay/capacity 2020-12-11 14:00:20 -08:00
David Tolnay
dc62d713bc
Expose Vec capacity to C++ 2020-12-11 13:53:17 -08:00
David Tolnay
2b3117f508
Release 1.0.15 1.0.15 2020-12-10 20:08:45 -08:00
David Tolnay
265cd4c7dc
Merge pull request #563 from dtolnay/shared-ptr-primitive
Support shared_ptr of primitives
2020-12-10 20:08:28 -08:00
David Tolnay
9df2aac134
Remove SharedPtr to &mut conversions
These are broken because multiple SharedPtrs can point to the same data,
and getting a &mut from each of them would result in multiple &mut to
overlapping data.
2020-12-10 20:06:57 -08:00
David Tolnay
f72b0c6182
Suppress modernize-use-equals-default
Clang-tidy emits this warning:

    src/cxx.cc:338:3: warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]
      MaybeUninit() {}
      ^             ~~
                    = default;
    src/cxx.cc:339:3: warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
      ~MaybeUninit() {}
      ^              ~~
                     = default;

but following the suggestion makes the code not compile (the default
implementation of the default constructor "is implicitly deleted because
the default definition would be ill-formed").

    src/cxx.cc: In function ‘std::string* cxxbridge1$std$shared_ptr$string$uninit(std::shared_ptr<std::__cxx11::basic_string<char> >*)’:
    src/cxx.cc:465:48: error: use of deleted function ‘rust::cxxbridge1::{anonymous}::MaybeUninit<T>::MaybeUninit() [with T = std::__cxx11::basic_string<char>]’
      465 |         reinterpret_cast<CXX_TYPE *>(new rust::MaybeUninit<CXX_TYPE>);         \
          |                                                ^~~~~~~~~~~~~~~~~~~~~
    src/cxx.cc:512:3: note: in expansion of macro ‘SHARED_PTR_OPS’
      512 |   MACRO(string, std::string)
          |   ^~~~~
    src/cxx.cc:517:1: note: in expansion of macro ‘FOR_EACH_SHARED_PTR’
      517 | FOR_EACH_SHARED_PTR(SHARED_PTR_OPS)
          | ^~~~~~~~~~~~~~~~~~~
    src/cxx.cc:338:3: note: ‘rust::cxxbridge1::{anonymous}::MaybeUninit<T>::MaybeUninit() [with T = std::__cxx11::basic_string<char>]’ is implicitly deleted because the default definition would be ill-formed:
      338 |   MaybeUninit() = default;
          |   ^~~~~~~~~~~
    src/cxx.cc:337:5: error: union member ‘rust::cxxbridge1::{anonymous}::MaybeUninit<std::__cxx11::basic_string<char> >::value’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
      337 |   T value;
          |     ^~~~~
2020-12-10 19:54:22 -08:00
David Tolnay
5b16340b67
Support shared_ptr of primitives 2020-12-10 19:48:37 -08:00
David Tolnay
1cde514d94
Clean up unused mut from Unique-/SharedPtr expansion 2020-12-10 19:48:20 -08:00
David Tolnay
53c9b047d6
Update ui test suite to nightly-2020-12-11 2020-12-10 18:27:07 -08:00
David Tolnay
a7b2b30c28
Release 1.0.14 1.0.14 2020-12-10 12:22:18 -08:00
David Tolnay
665b7f5b6c
Merge pull request #560 from dtolnay/relocatable
Mark all shared structs as relocatable
2020-12-10 12:04:51 -08:00
David Tolnay
5554ebd136
Mark all shared structs as relocatable 2020-12-10 11:37:01 -08:00
David Tolnay
b43417e2a6
Merge pull request #559 from dtolnay/pod
Improve POD detection for structs with POD fields
2020-12-10 11:36:52 -08:00
David Tolnay
0beba91b49
Improve POD detection for structs with POD fields 2020-12-09 23:54:08 -08:00
David Tolnay
8779ecc0f3
Merge pull request #558 from dtolnay/operator-new
Respect class-specific member operator new in MaybeUninit allocation
2020-12-09 23:27:25 -08:00