Skip to content

Commit

Permalink
Ui tests with compile_error resolved at call site
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 8, 2023
1 parent f5bcbec commit 55233ed
Show file tree
Hide file tree
Showing 42 changed files with 402 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/ui/array_len_expr.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
error: array length must be an integer literal
--> tests/ui/array_len_expr.rs:4:28
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | arraystr: [String; "13"],
| ^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsupported expression, array length must be an integer literal
--> tests/ui/array_len_expr.rs:5:28
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
5 | arraysub: [String; 15 - 1],
| ^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: array with zero size is not supported
--> tests/ui/array_len_expr.rs:6:20
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
6 | arrayzero: [String; 0],
| ^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
10 changes: 10 additions & 0 deletions tests/ui/async_fn.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
error: async function is not directly supported yet, but see https://cxx.rs/async.html for a working approach, and https://github.com/pcwalton/cxx-async for some helpers; eventually what you wrote will work but it isn't integrated into the cxx::bridge macro yet
--> tests/ui/async_fn.rs:4:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | async fn f();
| ^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: async function is not directly supported yet, but see https://cxx.rs/async.html for a working approach, and https://github.com/pcwalton/cxx-async for some helpers; eventually what you wrote will work but it isn't integrated into the cxx::bridge macro yet
--> tests/ui/async_fn.rs:8:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
8 | async fn g();
| ^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/bad_explicit_impl.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: unsupported Self type of explicit impl
--> tests/ui/bad_explicit_impl.rs:7:5
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
7 | impl fn() -> &S {}
| ^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
50 changes: 50 additions & 0 deletions tests/ui/by_value_not_supported.stderr
Original file line number Diff line number Diff line change
@@ -1,59 +1,109 @@
error: using opaque C++ type by value is not supported
--> tests/ui/by_value_not_supported.rs:4:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | c: C,
| ^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using opaque Rust type by value is not supported
--> tests/ui/by_value_not_supported.rs:5:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
5 | r: R,
| ^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: using C++ string by value is not supported
--> tests/ui/by_value_not_supported.rs:6:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
6 | s: CxxString,
| ^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: needs a cxx::ExternType impl in order to be used as a field of `S`, argument of `f` or return value of `f`
--> tests/ui/by_value_not_supported.rs:10:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
10 | type C;
| ^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: passing opaque C++ type by value is not supported
--> tests/ui/by_value_not_supported.rs:16:14
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
16 | fn f(c: C) -> C;
| ^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: returning opaque C++ type by value is not supported
--> tests/ui/by_value_not_supported.rs:16:23
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
16 | fn f(c: C) -> C;
| ^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: passing opaque Rust type by value is not supported
--> tests/ui/by_value_not_supported.rs:17:14
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
17 | fn g(r: R) -> R;
| ^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: returning opaque Rust type by value is not supported
--> tests/ui/by_value_not_supported.rs:17:23
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
17 | fn g(r: R) -> R;
| ^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: passing C++ string by value is not supported
--> tests/ui/by_value_not_supported.rs:18:14
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
18 | fn h(s: CxxString) -> CxxString;
| ^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: returning C++ string by value is not supported
--> tests/ui/by_value_not_supported.rs:18:31
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
18 | fn h(s: CxxString) -> CxxString;
| ^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/const_fn.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: const extern function is not supported
--> tests/ui/const_fn.rs:4:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | const fn f();
| ^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/data_enums.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: enums with data are not supported yet
--> tests/ui/data_enums.rs:4:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | Field(u64),
| ^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/empty_enum.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: explicit #[repr(...)] is required for enum without any variants
--> tests/ui/empty_enum.rs:3:5
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
2 | mod ffi {
3 | enum A {}
| ^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/empty_struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: structs without any fields are not supported
--> tests/ui/empty_struct.rs:3:5
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
2 | mod ffi {
3 | struct Empty {}
| ^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/enum_inconsistent.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: expected u16, found i64
--> tests/ui/enum_inconsistent.rs:5:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
5 | B = 2i64,
| ^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
10 changes: 10 additions & 0 deletions tests/ui/enum_out_of_bounds.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
error: discriminant value `18446744073709551615` is outside the limits of u32
--> tests/ui/enum_out_of_bounds.rs:5:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
5 | A = 0xFFFF_FFFF_FFFF_FFFF,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: discriminant value `2000` is outside the limits of u8
--> tests/ui/enum_out_of_bounds.rs:9:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
9 | B = 1u8,
| ^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/enum_overflows.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: discriminant overflow on value after 18446744073709551615
--> tests/ui/enum_overflows.rs:13:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
13 | F,
| ^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/enum_receiver.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: unsupported receiver type; C++ does not allow member functions on enums
--> tests/ui/enum_receiver.rs:7:20
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
7 | fn f(self: &Enum);
| ^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/enum_unsatisfiable.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
error: these discriminant values do not fit in any supported enum repr type
--> tests/ui/enum_unsatisfiable.rs:3:5
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
2 | mod ffi {
3 | / enum Bad {
4 | | A = -0xFFFF_FFFF_FFFF_FFFF,
5 | | B = 0xFFFF_FFFF_FFFF_FFFF,
6 | | }
| |_____^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/extern_fn_abi.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: explicit ABI on extern function is not supported
--> tests/ui/extern_fn_abi.rs:4:9
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | extern "Java" fn f();
| ^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
10 changes: 10 additions & 0 deletions tests/ui/extern_type_bound.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
error: extern type bounds are not implemented yet
--> tests/ui/extern_type_bound.rs:4:22
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | type Opaque: PartialEq + PartialOrd;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unsupported trait
--> tests/ui/extern_type_bound.rs:11:22
|
8 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
11 | type Opaque: for<'de> Deserialize<'de>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/extern_type_generic.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: extern type with generic type parameter is not supported yet
--> tests/ui/extern_type_generic.rs:4:22
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | type Generic<T>;
| ^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/extern_type_lifetime_bound.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: lifetime parameter with bounds is not supported yet
--> tests/ui/extern_type_lifetime_bound.rs:4:26
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | type Complex<'a, 'b: 'a>;
| ^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/fallible_fnptr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: function pointer returning Result is not supported yet
--> tests/ui/fallible_fnptr.rs:4:24
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | fn f(callback: fn() -> Result<()>);
| ^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions tests/ui/function_with_body.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: expected `;`
--> tests/ui/function_with_body.rs:4:16
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
4 | fn f() {}
| ^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
15 changes: 15 additions & 0 deletions tests/ui/generic_enum.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
error: enum with generic parameters is not supported
--> tests/ui/generic_enum.rs:3:5
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
2 | mod ffi {
3 | enum A<T> {
| ^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: enum with generic parameters is not supported
--> tests/ui/generic_enum.rs:7:5
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
7 | enum B<T> where T: Copy {
| ^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)

error: enum with where-clause is not supported
--> tests/ui/generic_enum.rs:11:12
|
1 | #[cxx::bridge]
| -------------- in this procedural macro expansion
...
11 | enum C where void: Copy {
| ^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
Loading

0 comments on commit 55233ed

Please sign in to comment.