279 Commits

Author SHA1 Message Date
David Tolnay
a141674f56
Add Box construction tests 2020-12-12 16:21:24 -08:00
David Tolnay
53c9b047d6
Update ui test suite to nightly-2020-12-11 2020-12-10 18:27:07 -08:00
David Tolnay
f33bc24057
Respect explicit impls on Vec and Box 2020-12-04 18:35:37 -08:00
David Tolnay
a7c80074e0
Update starlark targets with lib.rs.h dependency on module.rs.h 2020-12-04 17:42:34 -08:00
David Tolnay
99b3cb7bc4
Add test of returning Vec with struct from other bridge 2020-12-04 17:27:40 -08:00
David Tolnay
cb6562977a
Add Vec opaque type ui test 2020-12-04 17:22:41 -08:00
David Tolnay
a23d7fd9ef
Support root namespace in namespace attribute 2020-12-04 12:27:25 -08:00
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
b3b24a1fe0
Add Rust std::shared_ptr binding 2020-12-01 20:49:04 -08:00
David Tolnay
852d05f717
Test more derives 2020-12-01 14:49:47 -08:00
David Tolnay
f799b3781c
Add std::initializer_list constructor for rust::Vec 2020-11-30 00:11:30 -08:00
David Tolnay
2ecd4fd921
Change string comparison test to compile on MSVC
Error from MSVC:

> a parenthesized type followed by an initializer list is a non-standard
> explicit type conversion syntax
2020-11-29 22:56:05 -08:00
David Tolnay
c0674ccbab
Add string comparison tests 2020-11-29 22:47:17 -08:00
David Tolnay
b7eb65e428
Parse trait bounded extern types 2020-11-27 20:54:22 -08:00
David Tolnay
7da38209bf
Support derive(Hash) 2020-11-27 18:09:44 -08:00
David Tolnay
577135e79a
Support derive(PartialOrd, Ord) 2020-11-27 17:17:51 -08:00
David Tolnay
a6f3b6f4ec
Implement operator!= using a distinct symbol from operator== 2020-11-27 17:00:20 -08:00
David Tolnay
5f2b8ca2db
Add test of struct PartialEq operator== 2020-11-27 15:59:04 -08:00
David Tolnay
990eb3cf82
Test Debug impls 2020-11-27 13:26:54 -08:00
David Tolnay
f3b89fb23a
Preserve span of fields in derived Clone impl 2020-11-27 12:32:30 -08:00
David Tolnay
4d73379753
Add ui test of derives that fail due to field types 2020-11-27 12:24:22 -08:00
David Tolnay
b247df1d26
Preserve span on Derive trait impls 2020-11-27 12:20:49 -08:00
David Tolnay
4a0c53a7b0
Expand derives manually where allowed 2020-11-27 12:19:33 -08:00
David Tolnay
652cb50e33
Add test of duplicate derive on struct 2020-11-27 12:19:29 -08:00
David Tolnay
36bd61615d
Update tests to use c_char where appropriate 2020-11-25 20:13:05 -08:00
David Tolnay
5515a9e820
Generalize SliceRef codegen to non-u8 element type 2020-11-25 19:34:42 -08:00
David Tolnay
581f72dc8f
Disallow array with zero size 2020-11-25 16:00:03 -08:00
David Tolnay
38c1121df3
Allow simultaneous diagnostics on multiple fields of a struct 2020-11-25 15:50:19 -08:00
David Tolnay
819eeb7f5b
Convert array expr test to fields of a struct 2020-11-25 15:50:07 -08:00
David Tolnay
b004098cee
Add Vec cbegin/cend test 2020-11-25 14:29:15 -08:00
David Tolnay
9075bafa1d
Add array len parse ui tests 2020-11-24 21:17:07 -08:00
David Tolnay
c351dc40cd
Preserve lit token of array length 2020-11-24 21:17:06 -08:00
David Tolnay
f22fb65fcf
Add ui test of improper suffix on array len 2020-11-24 21:17:06 -08:00
David Tolnay
7750b8165a
Merge master into pr/459 2020-11-24 20:25:43 -08:00
Xiangpeng Hao
7876235c3f add initial array support 2020-11-24 20:23:29 -08:00
David Tolnay
f5ead103f3
Resolve clippy unnecessary_wraps lints 2020-11-24 17:08:05 -08:00
David Tolnay
c5629f021e
Support &mut [u8] 2020-11-24 13:45:27 -08:00
David Tolnay
cd271f2dc8
Add some more slice test functions 2020-11-24 12:38:18 -08:00
David Tolnay
94469c2077
Move aux types lower in test suite 2020-11-24 12:38:15 -08:00
David Tolnay
8988a75049
Format with rustfmt 1.4.27-nightly 2020-11-22 12:05:51 -08:00
David Tolnay
09a3086b45
Add UniquePtr::pin_mut 2020-11-22 12:04:38 -08:00
David Tolnay
227ff0cbf5
Fix test suite panic message forward compatibility lint
warning: panic message contains braces
       --> tests/test.rs:21:9
        |
    21  |         assert!(CORRECT.with(|correct| correct.get()), stringify!($run));
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    106 |     check!(ffi::c_take_shared(ffi::Shared { z: 2020 }));
        |     ---------------------------------------------------- in this macro invocation
        |
        = note: `#[warn(panic_fmt)]` on by default
        = note: this message is not used as a format string, but will be in a future Rust edition
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    help: add a "{}" format string to use the message literally
        |
    21  |         assert!(CORRECT.with(|correct| correct.get()), "{}", stringify!($run));
        |                                                        ^^^^^
2020-11-22 12:04:19 -08:00
David Tolnay
58eee39e60
Allow enum with undeclared variants as long as it has explicit repr 2020-11-20 20:37:58 -08:00
David Tolnay
300ef4a0f4
Add conditional DerefMut for UniquePtr 2020-11-19 20:28:29 -08:00
David Tolnay
da55763434
Add UniquePtr deref mut ui test 2020-11-19 20:21:32 -08:00
David Tolnay
ced2adc9c7
Remove check for duplicated discriminants
C++ enum and enum class are allowed to contain multiple enumerator
definitions with the same value. Our enum representation in Rust is
compatible with this too, so there is no need to error on such enums.

    enum class Enum {
      A = 5,
      B = 4,
      C = 4, // dup
      D, // = 5 dup
    };
2020-11-19 19:57:58 -08:00
David Tolnay
468063fb69
Add failing test of extern enum used as struct field
Currently fails with:

    error[cxxbridge]: needs a cxx::ExternType impl in order to be used as a field of `Second`
        ┌─ lib.rs:222:9
        │
    222 │         type COwnedEnum;
        │         ^^^^^^^^^^^^^^^ needs a cxx::ExternType impl in order to be used as a field of `Second`

which is wrong because the bridge should know it's producing a
compatible ExternType impl for this type.
2020-11-19 14:56:58 -08:00
David Tolnay
fbd0a8de26
Combine 'extra' and 'module' modules in test suite 2020-11-19 14:22:59 -08:00
David Tolnay
b2bf244a90
No longer need rustfmt::skip when using extern type alias 2020-11-19 14:00:38 -08:00