David Tolnay
12b4a16198
Merge pull request #550 from adetaylor/no-pin-trivial-2
...
Allow un-pinned Trivial extern types to be passed by reference as arguments
2020-12-20 20:25:09 -08:00
David Tolnay
8bc83389f1
Add String c_str test
2020-12-18 12:54:47 -08:00
David Tolnay
515ba1b420
Test some C++ member functions returning references
2020-12-18 11:04:18 -08:00
David Tolnay
b03d41d5d4
Remove unneeded Unpin import
...
Unpin is always available via the std prelude.
2020-12-16 10:18:29 -08:00
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
Adrian Taylor
f831a5abcf
Display all known reasons why type must be Trivial.
...
This generates multiple Rust-side and C++-side error messages
when a given opaque C++ type is being used in contexts which
allow only a Trivial type. Previously, we showed just the first
message and discarded all others.
2020-12-07 16:49:19 -08:00
Adrian Taylor
73f2daff89
Allow &mut calls on Trivial extern types only.
...
Previously we allowed extern types to be used as un-pinned
reference parameters only if there happened to be some other
use of the type in some way which required it to be Trivial.
With this change,
* Opaque extern types must always be pinned when used as mutable
reference parameters;
* Trivial extern types need never be pinned when used as mutable
reference parameters.
2020-12-07 16:25:59 -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
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
David Tolnay
c72a9f6ad6
Update cxx::bridge modules to use extern "C++" as the ABI
2020-11-11 10:57:50 -08:00
David Tolnay
ce29823968
Rename rust::Slice<T> to rust::Slice<const T>
2020-11-11 10:15:13 -08:00
David Tolnay
3f76b5d780
Merge pull request #446 from dtolnay/push
...
Add rust::Vec push_back and emplace_back
2020-11-10 20:16:14 -08:00
David Tolnay
fb6b73c777
Add rust::Vec push_back and emplace_back
2020-11-10 20:08:14 -08:00
David Tolnay
4ee0f84397
Merge pull request #443 from dtolnay/comma
...
Fix placement of commas in C++ member functions that call Rust methods
2020-11-10 08:56:37 -08:00
David Tolnay
74608d79bf
Add test of indirect return on member function
...
cxxbridge/sources/tests/ffi/lib.rs.cc: In member function ‘rust::cxxbridge05::String tests::Shared::r_method_on_shared() const’:
cxxbridge/sources/tests/ffi/lib.rs.cc:1583:52: error: no match for ‘operator&’ (operand types are ‘const tests::Shared’ and ‘rust::cxxbridge05::String’)
1583 | tests$cxxbridge05$Shared$r_method_on_shared(*this&return$.value);
| ~~~~~^~~~~~~~~~~~~~
| | |
| | rust::cxxbridge05::String
| const tests::Shared
2020-11-10 08:49:23 -08:00
David Tolnay
5d164678ae
Improve placement of diagnostic on Result without Display impl
2020-11-09 20:47:14 -08:00
David Tolnay
0e7e37f8e2
Suppress 'consider choosing a more descriptive name' clippy lint in tests
...
warning: consider choosing a more descriptive name
--> tests/ffi/lib.rs:247:30
|
247 | fn r_return_identity(_: usize) -> usize;
| ^
|
= note: `#[warn(clippy::just_underscores_and_digits)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#just_underscores_and_digits
warning: consider choosing a more descriptive name
--> tests/ffi/lib.rs:248:25
|
248 | fn r_return_sum(_: usize, _: usize) -> usize;
| ^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#just_underscores_and_digits
warning: consider choosing a more descriptive name
--> tests/ffi/lib.rs:248:35
|
248 | fn r_return_sum(_: usize, _: usize) -> usize;
| ^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#just_underscores_and_digits
2020-11-09 20:41:35 -08:00
David Tolnay
2621946855
Enforce accurate unsafety declaration on extern Rust sigs
2020-11-09 20:30:45 -08:00
David Tolnay
464d3fc0ac
Add test of unsupported elided lifetime in extern Rust sig
2020-11-09 20:30:45 -08:00
David Tolnay
5f8a70472a
Add test of missing unsafe on extern Rust sig
2020-11-09 20:30:45 -08:00
David Tolnay
9e2f590691
Add ui test of returning a non-displayable error
2020-11-09 20:17:12 -08:00
David Tolnay
464aeeb515
Rust-defined methods on shared structs
2020-11-08 19:14:06 -08:00
David Tolnay
102c7eaf68
C++-defined methods on shared structs
2020-11-08 19:08:31 -08:00
David Tolnay
a972eb7d93
Ignore field_reassign_with_default
2020-11-06 10:12:21 -08:00
David Tolnay
c90b666eec
Ignore some clippy lints in test suite
...
Closes #430 .
2020-11-06 10:11:14 -08:00
David Tolnay
35b662dfc3
Point out every field involved in the cycle
2020-11-03 18:51:41 -08:00
David Tolnay
07b7c13bc8
Add ui test of struct cycle
2020-11-03 18:41:48 -08:00
David Tolnay
392fbc6669
Add test of unsorted nested structs
2020-11-03 18:14:17 -08:00
David Tolnay
701c688476
Add repro of shared string by reference error
2020-11-02 18:20:08 -08:00
David Tolnay
7907966838
Switch to namespace = "quoted::path" in docs and tests
...
To preserve parity with item-level #[namespace = "..."] which is
currently restricted by rustc to a quoted string.
2020-11-01 09:12:05 -08:00
David Tolnay
ace45fa942
Re-enable c_take_callback test
2020-10-31 23:38:49 -07:00
David Tolnay
0aa9c773a1
Merge pull request #392 from adetaylor/namespace-forward-declarations
...
Namespace forward declarations
2020-10-31 22:39:47 -07:00
Adrian Taylor
9238b706a8
Test for namespace order sensitivity.
2020-10-31 22:15:24 -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
5df1f06eb8
Eliminate Str::Repr struct
2020-10-31 17:31:44 -07:00
David Tolnay
bf23e3e185
Format PR 370 with clang-format
2020-10-30 21:12:50 -07:00
Adrian Taylor
0447e96b84
Revert to older error string.
2020-10-29 21:22:24 -07:00
Adrian Taylor
f2d9d86c3d
Simplify test suite.
2020-10-29 21:21:30 -07:00
Adrian Taylor
3e5cff4a3d
Switch to #[namespace = A::B] syntax.
...
Thanks to sbrocket for this parsing code.
2020-10-29 19:48:45 -07:00
Adrian Taylor
c871343ac2
Allow namespace override.
...
This change allows a
#[namespace (namespace = A::B)]
attribute for each item in a cxx::bridge.
We now have a fair number of different types of name floating
around:
* C++ identifiers
* C++ fully-qualified names
* Rust identifiers
* Rust fully-qualified names (future, when we support sub-modules)
* Items with both a Rust and C++ name (a 'Pair')
* Types with only a known Rust name, which can be resolved to a
C++ name.
This change attempts to put some sensible names for all these
things in syntax/mod.rs, and so that would be a good place to start
review.
At the moment, the Namespace (included in each CppName)
is ruthlessly cloned all over the place. As a given namespace is
likely to be applicable to many types and functions, it may
save significant memory in future to use Rc<> here. But let's not
optimise too early.
2020-10-26 15:23:34 -07:00
Adrian Taylor
0fac321939
Adding tests for method calls in foreign namespaces
2020-10-26 15:17:02 -07:00
Adrian Taylor
ddc146ef9f
Adding tests for functions in other namespaces.
2020-10-26 15:17:02 -07:00
Adrian Taylor
d47af7a9d3
Tests for opaque C types in namepsaces
2020-10-26 15:17:02 -07:00
Adrian Taylor
585bb0bc56
Tests for namespaced extern trivial types
2020-10-26 15:17:02 -07:00
Adrian Taylor
5e79c64769
Tests for namespaced opaque extern types.
2020-10-26 15:17:02 -07:00
Adrian Taylor
9a158e408f
Adding tests for types in namespaces.
2020-10-26 15:17:02 -07:00
David Tolnay
743caa283c
Remove duplicated UniquePtr<C> impl in ui test
2020-10-16 13:22:47 -07:00
David Tolnay
441956e803
Match layout of C++ tests::E and struct E in Rust
2020-10-16 13:21:51 -07:00
David Tolnay
ca0f9da832
Format PR 361 with rustfmt
2020-10-16 13:18:54 -07:00
Adrian Taylor
9f7ff2e3a6
Switch to build-time squashing of 'new' method.
2020-10-12 20:14:17 -07:00
Adrian Taylor
117d3baac7
Bazel/Buck test build fixups.
...
Sacrifices to satisfy the PR builder guardians.
2020-10-12 16:33:30 -07:00
Adrian Taylor
d75f7e2911
Allow creation of UniquePtrs to trivial aliased types.
2020-10-12 16:16:19 -07:00
David Tolnay
362c9f92b0
Touch up PR 356
2020-10-10 16:30:04 -07:00
Adrian Taylor
1931ccf65e
Attempt at BUCK and BUILD files.
2020-10-10 16:19:20 -07:00
Adrian Taylor
121cca4a06
Add tests for ExternType.
2020-10-10 16:01:26 -07:00
David Tolnay
3bbcdbbbf6
Add test of cxx_/rust_name attributes
2020-10-09 20:22:23 -07:00
David Tolnay
8f16ae75f3
Bump namespace to 05
2020-10-08 19:34:50 -07:00
David Tolnay
d41eef59c9
Change test suite's include_prefix to match workspace path
2020-10-08 16:57:55 -07:00
David Tolnay
1f7a7e5bca
Touch up cxx_gen test
2020-10-04 19:50:35 -07:00
David Tolnay
821402b2a6
Move C++ generated code test to cxx's integration test
2020-10-04 19:50:35 -07:00
David Tolnay
0531f43ce9
Improve error message on a conflicting explicit impl
2020-10-04 00:36:56 -07:00
David Tolnay
64cab48688
Add ui test of explicit impl trait for type
2020-10-04 00:20:22 -07:00
David Tolnay
2b3c2b2fa4
Add ui test of invalid nonempty impl block
2020-10-04 00:20:22 -07:00
David Tolnay
50b7563de4
Add ui test of explicit impl with unsupported Self
2020-10-04 00:20:22 -07:00
David Tolnay
ac8394bd18
Add test of UniquePtrTarget impl conflict
2020-10-04 00:20:21 -07:00
David Tolnay
3208fd7a58
Provide more helpful error when opaque C++ type used by value
2020-10-03 21:10:05 -07:00
David Tolnay
9f69230783
Merge pull request #325 from adetaylor/with-trivial-2
...
Allow type aliases to be marked as Trivial.
2020-10-03 20:53:30 -07:00
Adrian Taylor
feb0dc104c
Fix expected error messages.
2020-09-30 16:51:31 -07:00
David Tolnay
e53ec04397
Bypass compiletest on Windows push and pull_request builds
2020-09-24 23:36:00 -04:00
David Tolnay
80631e93ef
Add test involving empty vector
2020-09-24 16:07:30 -04:00
David Tolnay
5df0a71dcf
Add test for CxxVector::as_slice
2020-09-24 15:58:58 -04:00
David Tolnay
717c7e6aa8
Factor out genrules to rust_cxx_bridge.bzl
2020-09-24 10:08:10 -04:00
David Tolnay
dc57990e22
Use more systematic naming for generated code targets
2020-09-24 10:00:50 -04:00
David Tolnay
0cd342913a
Make buck/bazel generated filepaths match source path with extension
2020-09-24 09:40:27 -04:00
David Tolnay
55151b4575
Match bazel's semantics for genrule cmd
2020-09-24 09:40:27 -04:00
David Tolnay
e02c8b3b98
Load cc_library from @rules_cc
...
Buildifier warns about this now.
Function "cc_library" is not global anymore and needs to be loaded
from "@rules_cc//cc:defs.bzl".buildifier(native-cc)
2020-09-24 08:58:09 -04:00
David Tolnay
e4d30f2257
Set test size of //tests:test Bazel test
...
Without this:
INFO: Analyzed 33 targets (1 packages loaded, 12 targets configured).
INFO: Found 32 targets and 1 test target...
INFO: Elapsed time: 0.905s, Critical Path: 0.66s
INFO: 3 processes: 3 linux-sandbox.
INFO: Build completed successfully, 3 total actions
//tests:test PASSED in 0.1s
WARNING: //tests:test: Test execution time (0.1s excluding execution overhead) outside of range for MODERATE tests. Consider setting timeout="short" or size="small".
2020-09-24 08:57:22 -04:00
David Tolnay
22602b43a8
Fix return Result<Box<T>> from Rust to C++
2020-09-21 18:22:37 -04:00
David Tolnay
d7fef0a162
Update ui tests to nightly-2020-09-05
2020-09-04 23:28:56 -07:00
David Tolnay
25db1555f5
Update import path scheme for tests
2020-09-01 22:41:15 -07:00
David Tolnay
7273963a61
Sort buck genrule args the way buildifier wants
...
https://github.com/bazelbuild/buildtools/tree/master/buildifier
2020-09-01 20:48:11 -07:00
David Tolnay
5e668bce9b
Format ui test files using rustfmt
2020-08-29 11:36:22 -07:00
David Tolnay
de1cb777b2
Specify consistent c++ standard between cxx and cxx-test-suite
2020-08-28 17:36:33 -07:00
David Tolnay
47e239df11
Implement CxxVector<CxxString>
2020-08-28 00:43:10 -07:00
David Tolnay
33f56ad8d5
Implement Vec<String>
2020-08-28 00:25:41 -07:00
David Tolnay
18d93b6d58
Add &mut tests
2020-08-27 01:00:18 -07:00
David Tolnay
a7ba6a629c
Format with rustfmt 1.4.20
2020-08-27 00:15:55 -07:00
David Tolnay
b10c4bc33a
Format with clang-format 10
2020-08-26 22:13:31 -07:00
David Tolnay
8e1e6ac25c
Extend exception message from Vec<T>::at
2020-08-26 22:13:31 -07:00
David Tolnay
61adf428be
Add test for Vec<T>::at exception message
2020-08-26 22:13:31 -07:00
David Tolnay
fb8ddd8eb3
Merge pull request #257 from rinon/rust_vec_accessors
...
Add rust::Vec accessors
2020-08-26 21:49:23 -07:00
David Tolnay
c8361027d9
Remove dependency of ui test on whether rust-src is installed
2020-08-25 22:03:00 -07:00
David Tolnay
691dc171b5
Update ui tests with rust-src component installed
2020-08-25 19:56:12 -07:00
David Tolnay
a08b19f5b1
Add include required for back_inserter
...
See failure in https://github.com/dtolnay/cxx/issues/260 .
2020-08-25 19:21:16 -07:00
Stephen Crane
9e48d5b5c6
Add rust::Vec accessors
...
Adds operator[], at(), front(), and back() to rust::Vec.
2020-08-21 12:17:02 -07:00
David Tolnay
291a8b87a1
Update to trybuild 1.0.32
2020-08-09 16:46:45 -07:00
David Tolnay
6911d6d604
Update ui tests to nightly-2020-07-15
2020-07-21 18:05:48 -07:00
David Tolnay
0067236217
Update ui tests to nightly-2020-07-07
2020-07-21 18:02:36 -07:00
David Tolnay
b3d5e600a7
Update ui tests to nightly-2020-06-27
2020-07-21 17:58:14 -07:00
David Tolnay
0c8c0f26fa
Unbreak ui test on c_take_callback warning
2020-07-21 17:57:46 -07:00
David Tolnay
bbd2620921
Update ui tests to nightly-2020-06-14
2020-06-13 19:17:21 -07:00
David Tolnay
ae7143655d
Test c method calls without needing PartialEq on Exception
2020-05-22 11:12:35 -07:00
myronahn
e3b78ea409
Fix issue with indirect return for C++ member function w/no args
2020-05-22 11:08:13 -07:00
Myron Ahn
d963bf97b7
Fix for when std::os::raw::c_char is u8 (armv7)
2020-05-17 12:32:42 +07:00
David Tolnay
cf96664b29
Test include parsing
2020-05-11 20:07:34 -07:00
David Tolnay
65bc8e6af8
Detect earlier untyped discriminants out of bounds of later suffix
2020-05-11 00:30:24 -07:00
David Tolnay
f6a89f2813
Respect inferred enum repr in C++ code generator
2020-05-10 23:45:51 -07:00
David Tolnay
c605e6fa61
Respect inferred enum repr in Rust code generator
2020-05-10 23:37:12 -07:00
David Tolnay
560661abe5
Test unsatisfiable discriminant range
2020-05-10 23:32:31 -07:00
David Tolnay
b24f52e289
Test inconsistent suffix on enum discriminants
2020-05-10 23:29:12 -07:00
David Tolnay
f85431239d
Test discriminant outside of the repr's bounds
2020-05-10 23:28:04 -07:00
David Tolnay
f2d584101d
Expand maximum recognized discriminant to 64 bits
2020-05-10 23:23:37 -07:00
Philip Craig
7e14e2e6cb
avoid MSVC warning via flag_if_supported
2020-05-09 12:00:49 -07:00
David Tolnay
ae4dedab55
Update build files of test suite
2020-05-08 02:23:10 -07:00
David Tolnay
094db3ecea
Document ExternType trait
2020-05-08 02:06:30 -07:00
David Tolnay
a62cca2268
Add a use of type alias to test suite
2020-05-07 23:20:06 -07:00
David Tolnay
83fe0f06d5
Preserve a better span for type id mismatch errors
2020-05-07 20:14:49 -07:00
David Tolnay
c6ba2d27f4
Condense type ids rendered by rustc
2020-05-07 19:46:02 -07:00
David Tolnay
9f07303af1
Add ui test of type_id mismatch
2020-05-07 19:46:02 -07:00
David Tolnay
e2f9ec4c89
Type alias parsing
2020-05-07 19:46:02 -07:00
David Tolnay
a3f6407efa
Expand discriminant overflow error message
...
Renders as:
error[cxxbridge]: discriminant overflow on value after 4294967295
┌─ src/main.rs:11:9
│
11 │ B,
│ ^ discriminant overflow
│
= note: explicitly set `= 0` if that is desired outcome
This more closely matches rustc's error message, which is:
error[E0370]: enum discriminant overflowed
--> src/lib.rs:4:5
|
4 | B,
| ^ overflowed on value after 255
|
= note: explicitly set `B = 0` if that is desired outcome
2020-05-05 10:28:00 -07:00
David Tolnay
884d91f0bc
Resolve absurd_extreme_comparisons lint
2020-05-05 10:17:23 -07:00
Joel Galenson
8854773c56
Compute enum discriminant during parsing
...
This allows us to reuse the computation in multiple places later.
2020-05-05 08:32:32 -07:00
Joel Galenson
0f654ffeb0
Fix previous commit.
2020-05-04 20:04:21 -07:00
David Tolnay
4c14162d34
Update multi parse errors ui test
2020-05-04 01:30:09 -07:00
David Tolnay
15a6c76352
Add test of invocation with multiple parse errors
2020-05-04 01:29:01 -07:00
Joel Galenson
db1ec31283
Expose the enum value to Rust as a field
2020-05-01 14:00:48 -07:00