Commit Graph

253 Commits

Author SHA1 Message Date
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
David Tolnay
80ef068ea0
Produce error message for a few more unsupported signatures 2020-11-19 13:57:42 -08:00
David Tolnay
8de461f44a
Improve async fn error message with link to workaround 2020-11-19 13:46:14 -08:00
David Tolnay
7c5c7bef34
Add ui test of async extern fn 2020-11-19 13:41:01 -08:00
David Tolnay
0f0162f37d
Bump namespace to 1 2020-11-17 08:30:10 -08:00
David Tolnay
62cae8e16c
Restrict extern Rust types to unique local types for now 2020-11-17 08:01:08 -08:00
David Tolnay
6fdeeebee0
Remove &mut T access from UniquePtr 2020-11-16 23:33:49 -08:00
David Tolnay
9938b6449d
Allow lifetime in extern fn signature 2020-11-15 19:09:01 -08:00
David Tolnay
9eef609c19
Enforce no explicit Unpin impls 2020-11-15 18:02:32 -08:00
David Tolnay
0fe6ca2c44
Add ui test with explicit Unpin impl 2020-11-15 17:34:30 -08:00
David Tolnay
20fa62bf71
Enforce opaque Rust types are unpin for now 2020-11-15 17:34:05 -08:00
David Tolnay
c90897fb2f
Add ui test with pinned extern Rust type 2020-11-15 17:30:20 -08:00
David Tolnay
dbc86ead14
Add mut opaque ui test 2020-11-15 17:22:21 -08:00
David Tolnay
14a49435f8
More test suite pins 2020-11-15 17:15:48 -08:00
David Tolnay
1346ca319d
Introduce pins in test suite 2020-11-15 16:13:15 -08:00
David Tolnay
95dab1db60
Ensure opaque types are !Unpin 2020-11-15 14:50:58 -08:00
David Tolnay
cf9aed6fd9
Add Unpin to autotraits test 2020-11-15 14:50:49 -08:00
David Tolnay
836341a643
Fix conflict between pr 456 and fallible fn ui test 2020-11-15 14:49:05 -08:00
David Tolnay
5e0d82f59d
Merge pull request #456 from dtolnay/unsafe
Enforce unsafe surrounding block on safe-to-call functions
2020-11-15 14:45:05 -08:00
David Tolnay
77cb5c17ef
Add ui test of opaque type autotraits 2020-11-15 14:26:27 -08:00
David Tolnay
57c166d775
Improve error message spanning for fallible fn ptr 2020-11-14 23:40:43 -08:00
David Tolnay
579cfbe82c
Add fallible function pointer ui test 2020-11-14 23:40:18 -08:00
David Tolnay
1126426ab7
Merge pull request #454 from dtolnay/externcxx
Enforce use of extern "C++" as the ABI string
2020-11-11 11:33:37 -08:00
David Tolnay
6bd29d526b
Merge pull request #453 from dtolnay/sliceconst
Rename rust::Slice<T> to rust::Slice<const T>
2020-11-11 11:33:02 -08:00
David Tolnay
7be5b1f134
Enforce unsafe surrounding block on safe-to-call functions 2020-11-11 11:09:33 -08:00
David Tolnay
ea25ac8df5
Enforce use of extern "C++" as the ABI string 2020-11-11 11:04:08 -08:00
David Tolnay
8685745538
Merge pull request #455 from dtolnay/cxxabi
Update cxx::bridge modules to use extern "C++" as the ABI
2020-11-11 11:03:34 -08:00