David Tolnay
300072b5f3
Touch up PR 538
2020-12-03 12:27:27 -08:00
Yan Zaretskiy
efd5cd443c
Implement the random access iterator for rust::Vec
2020-12-03 09:22:22 -05:00
David Tolnay
908d5e5dc5
Add non-const indexing for rust::Vec
2020-11-30 00:37:22 -08:00
David Tolnay
f799b3781c
Add std::initializer_list constructor for rust::Vec
2020-11-30 00:11:30 -08:00
David Tolnay
ff86dce342
Add comparison operators for Str and String
2020-11-29 22:37:49 -08:00
David Tolnay
828e513a94
Add Str(const String &) noexcept constructor
2020-11-29 20:41:26 -08:00
David Tolnay
f031c32dca
Remove TryFn since throwing fn ptr are not implemented yet
2020-11-29 19:41:33 -08:00
David Tolnay
e468f05d8f
Link to bindings documentation on website from header
2020-11-29 19:39:35 -08:00
David Tolnay
ff7f5fb8cc
Add String and Str iterators
2020-11-25 21:06:33 -08:00
David Tolnay
d1df4c7621
Include <iterator> for input_iterator_tag
2020-11-25 20:38:16 -08:00
David Tolnay
ac6cb54e3b
Add iterator for rust::Slice
2020-11-25 20:27:32 -08:00
David Tolnay
7b16a39a02
Consider T alignment for empty rust::Slice
2020-11-25 20:23:14 -08:00
David Tolnay
248215e206
Replace uint8_t with char for byte-based computations in Vec iterator
2020-11-25 19:41:16 -08:00
David Tolnay
5515a9e820
Generalize SliceRef codegen to non-u8 element type
2020-11-25 19:34:42 -08:00
David Tolnay
a857c32d40
Public deleted Opaque special members to resolve modernize-use-equals-delete
...
include/cxx.h:303:3: warning: deleted member function should be public [modernize-use-equals-delete]
Opaque() = delete;
^
include/cxx.h:304:3: warning: deleted member function should be public [modernize-use-equals-delete]
Opaque(const Opaque &) = delete;
^
include/cxx.h:305:3: warning: deleted member function should be public [modernize-use-equals-delete]
~Opaque() = delete;
^
2020-11-25 16:27:25 -08:00
David Tolnay
365fc7c66a
Add common base class for opaque Rust types
2020-11-25 16:22:54 -08:00
David Tolnay
a5d72c6b99
Share type between Vec<T>::const_iterator and Vec<const T>::iterator
2020-11-25 14:36:59 -08:00
David Tolnay
960b511adc
Add rust::Vec mutable iterator
2020-11-25 13:31:54 -08:00
David Tolnay
66f216c776
Move Vec<T>::const_iterator definition out of line
2020-11-25 13:25:52 -08:00
David Tolnay
ee9b9eebad
Remove unneeded copy_assignable_if template parameter name
2020-11-25 08:28:50 -08:00
David Tolnay
c5629f021e
Support &mut [u8]
2020-11-24 13:45:27 -08:00
David Tolnay
2714d2c98f
Resolve modernize-use-override
...
https://github.com/dtolnay/cxx/issues/500
2020-11-23 18:17:45 -08:00
David Tolnay
79076c7b71
Resolve modernize-use-equals-default
...
https://github.com/dtolnay/cxx/issues/500
2020-11-23 18:17:01 -08:00
David Tolnay
1567186114
Resolve some instances of cppcoreguidelines-pro-type-member-init
...
https://github.com/dtolnay/cxx/issues/500
2020-11-23 18:14:34 -08:00
David Tolnay
733cd260f0
Remove deletion of Str(std::string &&) constructor
2020-11-21 11:57:59 -08:00
David Tolnay
0f0162f37d
Bump namespace to 1
2020-11-17 08:30:10 -08:00
David Tolnay
d9deed1186
Merge demo tweaks into master
2020-11-12 15:28:42 -08:00
David Tolnay
4e8c49ada4
Prefer typename consistently where supported by c++11
2020-11-11 15:53:23 -08:00
David Tolnay
ce29823968
Rename rust::Slice<T> to rust::Slice<const T>
2020-11-11 10:15:13 -08:00
David Tolnay
fb6b73c777
Add rust::Vec push_back and emplace_back
2020-11-10 20:08:14 -08:00
David Tolnay
a5a1301058
Provide rust::Fn call operator in generated header
...
Even though the generated code does not use them, this avoids a
situation where the user's code includes a generated header (but not
rust/cxx.h) and thus gets the class definition of rust::Fn, but with the
function call operators undefined. Previously they'd have gotten missing
template errors unless they also included rust/cxx.h.
2020-11-10 19:03:52 -08:00
David Tolnay
174bd95116
Expose way to bypass trivial destr/move on extern types passed by value
2020-11-02 10:23:52 -08:00
David Tolnay
36aa9e0bd8
Eliminate Slice<T>::Repr struct
2020-10-31 23:24:31 -07:00
David Tolnay
0356d33acb
Pass Str in PtrLen representation
...
MSVC is hesitant about passing private fields in an extern "C" signature.
Repro:
struct Str1 {
const char *ptr;
size_t len;
};
struct Str2 {
private:
const char *ptr;
size_t len;
};
extern "C" {
Str1 str1();
Str2 str2();
}
Warning from MSVC v19.27:
warning C4190: 'str2' has C-linkage specified, but returns UDT 'Str2' which is incompatible with C
2020-10-31 20:33:39 -07:00
David Tolnay
5b1ee1fc4e
Inline some Str accessors into the header
2020-10-31 18:21:39 -07:00
David Tolnay
2d7f117494
Make Str, Slice trivially copy assignable
2020-10-31 17:58:31 -07:00
David Tolnay
5df1f06eb8
Eliminate Str::Repr struct
2020-10-31 17:31:44 -07:00
David Tolnay
1549106cb0
Add move assignment operator for Error
2020-10-31 17:26:23 -07:00
David Tolnay
7c6ac7195e
Add copy assignment operator for Error
2020-10-31 17:24:32 -07:00
David Tolnay
84ddf9e27f
Move "impl" into anonymous namespace
2020-10-31 16:59:29 -07:00
David Tolnay
a0c9bc7167
Decouple Error from Str::Repr
...
It was misleading to use Str (which ordinarily represents borrowed
strings) also for owned error messages.
2020-10-31 16:59:29 -07:00
David Tolnay
4852122f35
Fill in some missing final specifiers
2020-10-31 14:59:42 -07:00
David Tolnay
de9a5b12b3
Guarantee trivial copy constructor and destructor for Str and Slice
...
Repro:
const char *ptr(Str str) { return str.repr.ptr; }
size_t len(Str str) { return str.repr.len; }
Before:
ptr(Str):
mov rax, qword ptr [rdi]
ret
len(Str):
mov rax, qword ptr [rdi + 8]
ret
After:
ptr(Str):
mov rax, rdi
ret
len(Str):
mov rax, rsi
ret
2020-10-31 12:17:42 -07:00
David Tolnay
cedcde1ddd
Fill in missing const on operator Repr
2020-10-31 11:47:14 -07:00
David Tolnay
8f16ae75f3
Bump namespace to 05
2020-10-08 19:34:50 -07:00
David Tolnay
da38b7c2a5
Update case of basetsd.h import to support cross compilation
2020-09-16 11:55:24 -04:00
David Tolnay
e4fa873f5f
Allow rust::Error to be caught as std::exception&
2020-09-08 15:04:56 -07:00
David Tolnay
38c8764d82
Add rust::slice and rust::vec lowercase aliases
2020-09-06 22:18:08 -07:00
David Tolnay
16ab146183
Fix missing panic template when using Vec
...
#277
2020-09-02 15:15:25 -07:00
David Tolnay
591dcb647d
Bump namespace to 04
2020-09-01 23:00:38 -07:00