Vendor dependencies

Let's see how I like this workflow.
This commit is contained in:
John Doty 2022-12-19 08:27:18 -08:00
parent 34d1830413
commit 9c435dc440
7500 changed files with 1665121 additions and 99 deletions

10
vendor/cxx/tests/ui/array_len_expr.rs vendored Normal file
View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
struct Shared {
arraystr: [String; "13"],
arraysub: [String; 15 - 1],
arrayzero: [String; 0],
}
}
fn main() {}

View file

@ -0,0 +1,17 @@
error: array length must be an integer literal
--> tests/ui/array_len_expr.rs:4:28
|
4 | arraystr: [String; "13"],
| ^^^^
error: unsupported expression, array length must be an integer literal
--> tests/ui/array_len_expr.rs:5:28
|
5 | arraysub: [String; 15 - 1],
| ^^^^^^
error: array with zero size is not supported
--> tests/ui/array_len_expr.rs:6:20
|
6 | arrayzero: [String; 0],
| ^^^^^^^^^^^

View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
fn array() -> [String; 12u16];
}
}
fn main() {}

View file

@ -0,0 +1,10 @@
error[E0308]: mismatched types
--> tests/ui/array_len_suffix.rs:4:32
|
4 | fn array() -> [String; 12u16];
| ^^^^^ expected `usize`, found `u16`
|
help: change the type of the numeric literal from `u16` to `usize`
|
4 | fn array() -> [String; 12usize];
| ~~~~~

14
vendor/cxx/tests/ui/async_fn.rs vendored Normal file
View file

@ -0,0 +1,14 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
async fn f();
}
extern "C++" {
async fn g();
}
}
async fn f() {}
fn main() {}

11
vendor/cxx/tests/ui/async_fn.stderr vendored Normal file
View file

@ -0,0 +1,11 @@
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
|
4 | async fn f();
| ^^^^^^^^^^^^^
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
|
8 | async fn g();
| ^^^^^^^^^^^^^

View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
struct S {
x: u8,
}
impl fn() -> &S {}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: unsupported Self type of explicit impl
--> tests/ui/bad_explicit_impl.rs:7:5
|
7 | impl fn() -> &S {}
| ^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,22 @@
#[cxx::bridge]
mod ffi {
struct S {
c: C,
r: R,
s: CxxString,
}
extern "C++" {
type C;
}
extern "Rust" {
type R;
fn f(c: C) -> C;
fn g(r: R) -> R;
fn h(s: CxxString) -> CxxString;
}
}
fn main() {}

View file

@ -0,0 +1,59 @@
error: using opaque C++ type by value is not supported
--> tests/ui/by_value_not_supported.rs:4:9
|
4 | c: C,
| ^^^^
error: using opaque Rust type by value is not supported
--> tests/ui/by_value_not_supported.rs:5:9
|
5 | r: R,
| ^^^^
error: using C++ string by value is not supported
--> tests/ui/by_value_not_supported.rs:6:9
|
6 | s: CxxString,
| ^^^^^^^^^^^^
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
|
10 | type C;
| ^^^^^^
error: passing opaque C++ type by value is not supported
--> tests/ui/by_value_not_supported.rs:16:14
|
16 | fn f(c: C) -> C;
| ^^^^
error: returning opaque C++ type by value is not supported
--> tests/ui/by_value_not_supported.rs:16:23
|
16 | fn f(c: C) -> C;
| ^
error: passing opaque Rust type by value is not supported
--> tests/ui/by_value_not_supported.rs:17:14
|
17 | fn g(r: R) -> R;
| ^^^^
error: returning opaque Rust type by value is not supported
--> tests/ui/by_value_not_supported.rs:17:23
|
17 | fn g(r: R) -> R;
| ^
error: passing C++ string by value is not supported
--> tests/ui/by_value_not_supported.rs:18:14
|
18 | fn h(s: CxxString) -> CxxString;
| ^^^^^^^^^^^^
error: returning C++ string by value is not supported
--> tests/ui/by_value_not_supported.rs:18:31
|
18 | fn h(s: CxxString) -> CxxString;
| ^^^^^^^^^

10
vendor/cxx/tests/ui/const_fn.rs vendored Normal file
View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
const fn f();
}
}
const fn f() {}
fn main() {}

5
vendor/cxx/tests/ui/const_fn.stderr vendored Normal file
View file

@ -0,0 +1,5 @@
error: const extern function is not supported
--> tests/ui/const_fn.rs:4:9
|
4 | const fn f();
| ^^^^^^^^^^^^^

8
vendor/cxx/tests/ui/data_enums.rs vendored Normal file
View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
enum A {
Field(u64),
}
}
fn main() {}

5
vendor/cxx/tests/ui/data_enums.stderr vendored Normal file
View file

@ -0,0 +1,5 @@
error: enums with data are not supported yet
--> tests/ui/data_enums.rs:4:9
|
4 | Field(u64),
| ^^^^^^^^^^

View file

@ -0,0 +1,27 @@
#![deny(elided_lifetimes_in_paths)]
#[cxx::bridge]
mod ffi {
#[derive(PartialEq, PartialOrd, Hash)]
struct Struct<'a> {
reference: &'a i32,
}
extern "Rust" {
type Rust<'a>;
}
unsafe extern "C++" {
type Cpp<'a>;
fn lifetime_named<'a>(s: &'a i32) -> UniquePtr<Cpp<'a>>;
fn lifetime_underscore(s: &i32) -> UniquePtr<Cpp<'_>>;
fn lifetime_elided(s: &i32) -> UniquePtr<Cpp>;
}
}
pub struct Rust<'a>(&'a i32);
fn main() {}

View file

@ -0,0 +1,15 @@
error: hidden lifetime parameters in types are deprecated
--> tests/ui/deny_elided_lifetimes.rs:21:50
|
21 | fn lifetime_elided(s: &i32) -> UniquePtr<Cpp>;
| ^^^ expected lifetime parameter
|
note: the lint level is defined here
--> tests/ui/deny_elided_lifetimes.rs:1:9
|
1 | #![deny(elided_lifetimes_in_paths)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: indicate the anonymous lifetime
|
21 | fn lifetime_elided(s: &i32) -> UniquePtr<Cpp<'_>>;
| ++++

View file

@ -0,0 +1,94 @@
// TODO: More work is needed so that the missing_docs lints produced by rustc
// are properly positioned inside of the bridge.
//! ...
#![deny(missing_docs)]
/// ...
#[cxx::bridge]
pub mod ffi {
pub struct UndocumentedStruct {
pub undocumented_field: u8,
}
/// ...
pub struct DocumentedStruct {
/// ...
pub documented_field: u8,
}
pub enum UndocumentedEnum {
UndocumentedVariant = 0,
}
/// ...
pub enum DocumentedEnum {
/// ...
DocumentedVariant = 0,
}
extern "Rust" {
pub type UndocumentedRustType;
/// ...
pub type DocumentedRustType;
pub fn undocumented_rust_fn() -> u8;
/// ...
pub fn documented_rust_fn() -> u8;
}
unsafe extern "C++" {
pub type UndocumentedForeignType;
/// ...
pub type DocumentedForeignType;
pub type UndocumentedTypeAlias = crate::bindgen::UndocumentedTypeAlias;
/// ...
pub type DocumentedTypeAlias = crate::bindgen::DocumentedTypeAlias;
pub fn undocumented_foreign_fn() -> u8;
/// ...
pub fn documented_foreign_fn() -> u8;
}
#[allow(missing_docs)]
pub struct SuppressUndocumentedStruct {
pub undocumented_field: u8,
}
}
struct UndocumentedRustType;
struct DocumentedRustType;
mod bindgen {
use cxx::{type_id, ExternType};
pub struct UndocumentedTypeAlias;
pub struct DocumentedTypeAlias;
unsafe impl ExternType for UndocumentedTypeAlias {
type Id = type_id!("UndocumentedTypeAlias");
type Kind = cxx::kind::Opaque;
}
unsafe impl ExternType for DocumentedTypeAlias {
type Id = type_id!("DocumentedTypeAlias");
type Kind = cxx::kind::Opaque;
}
}
fn undocumented_rust_fn() -> u8 {
0
}
fn documented_rust_fn() -> u8 {
0
}
fn main() {}

View file

@ -0,0 +1,47 @@
error: missing documentation for a struct
--> tests/ui/deny_missing_docs.rs:11:5
|
11 | pub struct UndocumentedStruct {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> tests/ui/deny_missing_docs.rs:6:9
|
6 | #![deny(missing_docs)]
| ^^^^^^^^^^^^
error: missing documentation for a struct field
--> tests/ui/deny_missing_docs.rs:12:9
|
12 | pub undocumented_field: u8,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a struct
--> tests/ui/deny_missing_docs.rs:21:5
|
21 | pub enum UndocumentedEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for an associated constant
--> tests/ui/deny_missing_docs.rs:22:9
|
22 | UndocumentedVariant = 0,
| ^^^^^^^^^^^^^^^^^^^
error: missing documentation for a struct
--> tests/ui/deny_missing_docs.rs:44:9
|
44 | pub type UndocumentedForeignType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a type alias
--> tests/ui/deny_missing_docs.rs:49:9
|
49 | pub type UndocumentedTypeAlias = crate::bindgen::UndocumentedTypeAlias;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
--> tests/ui/deny_missing_docs.rs:54:9
|
54 | pub fn undocumented_foreign_fn() -> u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,9 @@
#[cxx::bridge]
mod ffi {
#[derive(Clone, Clone)]
struct Struct {
x: usize,
}
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0119]: conflicting implementations of trait `Clone` for type `Struct`
--> tests/ui/derive_duplicate.rs:3:21
|
3 | #[derive(Clone, Clone)]
| ----- ^^^^^ conflicting implementation for `Struct`
| |
| first implementation here

13
vendor/cxx/tests/ui/derive_noncopy.rs vendored Normal file
View file

@ -0,0 +1,13 @@
#[cxx::bridge]
mod ffi {
#[derive(Copy)]
struct TryCopy {
other: Other,
}
struct Other {
x: usize,
}
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0204]: the trait `Copy` may not be implemented for this type
--> tests/ui/derive_noncopy.rs:4:12
|
4 | struct TryCopy {
| ^^^^^^^
5 | other: Other,
| ------------ this field does not implement `Copy`

14
vendor/cxx/tests/ui/drop_shared.rs vendored Normal file
View file

@ -0,0 +1,14 @@
#[cxx::bridge]
mod ffi {
struct Shared {
fd: i32,
}
}
impl Drop for ffi::Shared {
fn drop(&mut self) {
println!("close({})", self.fd);
}
}
fn main() {}

View file

@ -0,0 +1,8 @@
error[E0119]: conflicting implementations of trait `forbid::Drop` for type `Shared`
--> tests/ui/drop_shared.rs:3:5
|
1 | #[cxx::bridge]
| -------------- first implementation here
2 | mod ffi {
3 | struct Shared {
| ^^^^^^^^^^^^^ conflicting implementation for `Shared`

6
vendor/cxx/tests/ui/empty_enum.rs vendored Normal file
View file

@ -0,0 +1,6 @@
#[cxx::bridge]
mod ffi {
enum A {}
}
fn main() {}

5
vendor/cxx/tests/ui/empty_enum.stderr vendored Normal file
View file

@ -0,0 +1,5 @@
error: explicit #[repr(...)] is required for enum without any variants
--> tests/ui/empty_enum.rs:3:5
|
3 | enum A {}
| ^^^^^^^^^

6
vendor/cxx/tests/ui/empty_struct.rs vendored Normal file
View file

@ -0,0 +1,6 @@
#[cxx::bridge]
mod ffi {
struct Empty {}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: structs without any fields are not supported
--> tests/ui/empty_struct.rs:3:5
|
3 | struct Empty {}
| ^^^^^^^^^^^^^^^

View file

@ -0,0 +1,9 @@
#[cxx::bridge]
mod ffi {
enum Bad {
A = 1u16,
B = 2i64,
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: expected u16, found i64
--> tests/ui/enum_inconsistent.rs:5:9
|
5 | B = 2i64,
| ^^^^^^^^

View file

@ -0,0 +1,16 @@
#[cxx::bridge]
mod ffi {
enum A {
FieldA,
FieldB,
}
}
fn main() {}
fn matcher(a: ffi::A) -> u32 {
match a {
ffi::A::FieldA => 2020,
ffi::A::FieldB => 2021,
}
}

View file

@ -0,0 +1,17 @@
error[E0004]: non-exhaustive patterns: `ffi::A { repr: 2_u8..=u8::MAX }` not covered
--> tests/ui/enum_match_without_wildcard.rs:12:11
|
12 | match a {
| ^ pattern `ffi::A { repr: 2_u8..=u8::MAX }` not covered
|
note: `ffi::A` defined here
--> tests/ui/enum_match_without_wildcard.rs:3:10
|
3 | enum A {
| ^
= note: the matched value is of type `ffi::A`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
14 ~ ffi::A::FieldB => 2021,
15 ~ ffi::A { repr: 2_u8..=u8::MAX } => todo!(),
|

View file

@ -0,0 +1,13 @@
#[cxx::bridge]
mod ffi {
#[repr(u32)]
enum Bad1 {
A = 0xFFFF_FFFF_FFFF_FFFF,
}
enum Bad2 {
A = 2000,
B = 1u8,
}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: discriminant value `18446744073709551615` is outside the limits of u32
--> tests/ui/enum_out_of_bounds.rs:5:9
|
5 | A = 0xFFFF_FFFF_FFFF_FFFF,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: discriminant value `2000` is outside the limits of u8
--> tests/ui/enum_out_of_bounds.rs:9:9
|
9 | B = 1u8,
| ^^^^^^^

17
vendor/cxx/tests/ui/enum_overflows.rs vendored Normal file
View file

@ -0,0 +1,17 @@
#[cxx::bridge]
mod ffi {
enum Good1 {
A = 0xFFFF_FFFF_FFFF_FFFF,
}
enum Good2 {
B = 0xFFFF_FFFF_FFFF_FFFF,
C = 2020,
}
enum Bad {
D = 0xFFFF_FFFF_FFFF_FFFE,
E,
F,
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: discriminant overflow on value after 18446744073709551615
--> tests/ui/enum_overflows.rs:13:9
|
13 | F,
| ^

11
vendor/cxx/tests/ui/enum_receiver.rs vendored Normal file
View file

@ -0,0 +1,11 @@
#[cxx::bridge]
mod ffi {
enum Enum {
Variant,
}
extern "Rust" {
fn f(self: &Enum);
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: unsupported receiver type; C++ does not allow member functions on enums
--> tests/ui/enum_receiver.rs:7:20
|
7 | fn f(self: &Enum);
| ^^^^^

View file

@ -0,0 +1,9 @@
#[cxx::bridge]
mod ffi {
enum Bad {
A = -0xFFFF_FFFF_FFFF_FFFF,
B = 0xFFFF_FFFF_FFFF_FFFF,
}
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: these discriminant values do not fit in any supported enum repr type
--> tests/ui/enum_unsatisfiable.rs:3:5
|
3 | / enum Bad {
4 | | A = -0xFFFF_FFFF_FFFF_FFFF,
5 | | B = 0xFFFF_FFFF_FFFF_FFFF,
6 | | }
| |_____^

9
vendor/cxx/tests/ui/expected_named.rs vendored Normal file
View file

@ -0,0 +1,9 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type Borrowed<'a>;
fn borrowed() -> UniquePtr<Borrowed>;
}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0106]: missing lifetime specifier
--> tests/ui/expected_named.rs:5:36
|
5 | fn borrowed() -> UniquePtr<Borrowed>;
| ^^^^^^^^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
|
5 | fn borrowed() -> UniquePtr<Borrowed<'static>>;
| +++++++++

8
vendor/cxx/tests/ui/extern_fn_abi.rs vendored Normal file
View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
extern "Java" fn f();
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: explicit ABI on extern function is not supported
--> tests/ui/extern_fn_abi.rs:4:9
|
4 | extern "Java" fn f();
| ^^^^^^^^^^^^^

View file

@ -0,0 +1,15 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
type Opaque: PartialEq + PartialOrd;
}
}
#[cxx::bridge]
mod ffi {
extern "C++" {
type Opaque: for<'de> Deserialize<'de>;
}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: extern type bounds are not implemented yet
--> tests/ui/extern_type_bound.rs:4:22
|
4 | type Opaque: PartialEq + PartialOrd;
| ^^^^^^^^^^^^^^^^^^^^^^
error: unsupported trait
--> tests/ui/extern_type_bound.rs:11:22
|
11 | type Opaque: for<'de> Deserialize<'de>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
type Generic<T>;
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: extern type with generic type parameter is not supported yet
--> tests/ui/extern_type_generic.rs:4:22
|
4 | type Generic<T>;
| ^

View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
type Complex<'a, 'b: 'a>;
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: lifetime parameter with bounds is not supported yet
--> tests/ui/extern_type_lifetime_bound.rs:4:26
|
4 | type Complex<'a, 'b: 'a>;
| ^^^^^^

8
vendor/cxx/tests/ui/fallible_fnptr.rs vendored Normal file
View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
fn f(callback: fn() -> Result<()>);
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: function pointer returning Result is not supported yet
--> tests/ui/fallible_fnptr.rs:4:24
|
4 | fn f(callback: fn() -> Result<()>);
| ^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
fn f() {}
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: expected `;`
--> tests/ui/function_with_body.rs:4:16
|
4 | fn f() {}
| ^

16
vendor/cxx/tests/ui/generic_enum.rs vendored Normal file
View file

@ -0,0 +1,16 @@
#[cxx::bridge]
mod ffi {
enum A<T> {
Field,
}
enum B<T> where T: Copy {
Field,
}
enum C where void: Copy {
Field,
}
}
fn main() {}

17
vendor/cxx/tests/ui/generic_enum.stderr vendored Normal file
View file

@ -0,0 +1,17 @@
error: enum with generic parameters is not supported
--> tests/ui/generic_enum.rs:3:5
|
3 | enum A<T> {
| ^^^^^^^^^
error: enum with generic parameters is not supported
--> tests/ui/generic_enum.rs:7:5
|
7 | enum B<T> where T: Copy {
| ^^^^^^^^^
error: enum with where-clause is not supported
--> tests/ui/generic_enum.rs:11:12
|
11 | enum C where void: Copy {
| ^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
struct S {
x: u8,
}
impl UniquePtrTarget for S {}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: unexpected impl, expected something like `impl UniquePtr<T> {}`
--> tests/ui/impl_trait_for_type.rs:7:10
|
7 | impl UniquePtrTarget for S {}
| ^^^^^^^^^^^^^^^^^^^^^

12
vendor/cxx/tests/ui/include.rs vendored Normal file
View file

@ -0,0 +1,12 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
include!("path/to" what);
include!(<path/to> what);
include!(<path/to);
include!(<path[to]>);
include!(...);
}
}
fn main() {}

29
vendor/cxx/tests/ui/include.stderr vendored Normal file
View file

@ -0,0 +1,29 @@
error: unexpected token
--> tests/ui/include.rs:4:28
|
4 | include!("path/to" what);
| ^^^^
error: unexpected token
--> tests/ui/include.rs:5:28
|
5 | include!(<path/to> what);
| ^^^^
error: expected `>`
--> tests/ui/include.rs:6:17
|
6 | include!(<path/to);
| ^^^^^^^^^^
error: unexpected token in include path
--> tests/ui/include.rs:7:23
|
7 | include!(<path[to]>);
| ^^^^
error: expected "quoted/path/to" or <bracketed/path/to>
--> tests/ui/include.rs:8:18
|
8 | include!(...);
| ^

View file

@ -0,0 +1,9 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
type Opaque;
unsafe fn f<'a>(&'a self, arg: &str) -> &'a str;
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: extern C++ function with lifetimes must be declared in `unsafe extern "C++"` block
--> tests/ui/lifetime_extern_cxx.rs:5:9
|
5 | unsafe fn f<'a>(&'a self, arg: &str) -> &'a str;
| ^^^^^^^^^^^^^^^

View file

@ -0,0 +1,17 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
type Opaque;
fn f<'a>(&'a self, arg: &str) -> &'a str;
}
}
pub struct Opaque;
impl Opaque {
fn f(&self, _arg: &str) -> &str {
""
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: must be `unsafe fn f` in order to expose explicit lifetimes to C++
--> tests/ui/lifetime_extern_rust.rs:5:9
|
5 | fn f<'a>(&'a self, arg: &str) -> &'a str;
| ^^^^^^^^

10
vendor/cxx/tests/ui/missing_unsafe.rs vendored Normal file
View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
fn f(x: i32);
}
}
unsafe fn f(_x: i32) {}
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> tests/ui/missing_unsafe.rs:4:12
|
4 | fn f(x: i32);
| ^ - items do not inherit unsafety from separate enclosing items
| |
| call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior

View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
struct Monad<T>;
extern "Haskell" {}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: unit structs are not supported
--> tests/ui/multiple_parse_error.rs:3:5
|
3 | struct Monad<T>;
| ^^^^^^^^^^^^^^^^
error: unrecognized ABI, requires either "C++" or "Rust"
--> tests/ui/multiple_parse_error.rs:5:5
|
5 | extern "Haskell" {}
| ^^^^^^^^^^^^^^^^

18
vendor/cxx/tests/ui/mut_return.rs vendored Normal file
View file

@ -0,0 +1,18 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
type Mut<'a>;
}
unsafe extern "C++" {
type Thing;
fn f(t: &Thing) -> Pin<&mut CxxString>;
unsafe fn g(t: &Thing) -> Pin<&mut CxxString>;
fn h(t: Box<Mut>) -> Pin<&mut CxxString>;
fn i<'a>(t: Box<Mut<'a>>) -> Pin<&'a mut CxxString>;
fn j(t: &Thing) -> &mut [u8];
}
}
fn main() {}

11
vendor/cxx/tests/ui/mut_return.stderr vendored Normal file
View file

@ -0,0 +1,11 @@
error: &mut return type is not allowed unless there is a &mut argument
--> tests/ui/mut_return.rs:10:9
|
10 | fn f(t: &Thing) -> Pin<&mut CxxString>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: &mut return type is not allowed unless there is a &mut argument
--> tests/ui/mut_return.rs:14:9
|
14 | fn j(t: &Thing) -> &mut [u8];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
enum A {
Field = 2020 + 1,
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: enums with non-integer literal discriminants are not supported yet
--> tests/ui/non_integer_discriminant_enum.rs:4:9
|
4 | Field = 2020 + 1,
| ^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,12 @@
#[cxx::bridge]
mod ffi {
struct S {
x: u8,
}
impl UniquePtr<S> {
fn new() -> Self;
}
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: expected an empty impl block
--> tests/ui/nonempty_impl_block.rs:7:23
|
7 | impl UniquePtr<S> {
| _______________________^
8 | | fn new() -> Self;
9 | | }
| |_____^

View file

@ -0,0 +1,18 @@
pub struct MyBuilder<'a> {
_s: &'a str,
}
type OptBuilder<'a> = Option<MyBuilder<'a>>;
#[cxx::bridge]
mod ffi {
extern "Rust" {
type OptBuilder<'a>;
}
struct MyBuilder<'a> {
rs: Box<OptBuilder<'a>>,
}
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate
--> tests/ui/nonlocal_rust_type.rs:10:9
|
10 | type OptBuilder<'a>;
| ^^^^^--------------
| | |
| | `Option` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate
--> tests/ui/nonlocal_rust_type.rs:14:13
|
14 | rs: Box<OptBuilder<'a>>,
| ^^^^--------------
| | |
| | `Option` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead

View file

@ -0,0 +1,16 @@
#[cxx::bridge]
mod ffi {
extern "C++" {
type Opaque;
}
}
fn assert_send<T: Send>() {}
fn assert_sync<T: Sync>() {}
fn assert_unpin<T: Unpin>() {}
fn main() {
assert_send::<ffi::Opaque>();
assert_sync::<ffi::Opaque>();
assert_unpin::<ffi::Opaque>();
}

View file

@ -0,0 +1,59 @@
error[E0277]: `*const cxx::void` cannot be sent between threads safely
--> tests/ui/opaque_autotraits.rs:13:19
|
13 | assert_send::<ffi::Opaque>();
| ^^^^^^^^^^^ `*const cxx::void` cannot be sent between threads safely
|
= help: within `ffi::Opaque`, the trait `Send` is not implemented for `*const cxx::void`
= note: required because it appears within the type `[*const cxx::void; 0]`
= note: required because it appears within the type `cxx::private::Opaque`
note: required because it appears within the type `ffi::Opaque`
--> tests/ui/opaque_autotraits.rs:4:14
|
4 | type Opaque;
| ^^^^^^
note: required by a bound in `assert_send`
--> tests/ui/opaque_autotraits.rs:8:19
|
8 | fn assert_send<T: Send>() {}
| ^^^^ required by this bound in `assert_send`
error[E0277]: `*const cxx::void` cannot be shared between threads safely
--> tests/ui/opaque_autotraits.rs:14:19
|
14 | assert_sync::<ffi::Opaque>();
| ^^^^^^^^^^^ `*const cxx::void` cannot be shared between threads safely
|
= help: within `ffi::Opaque`, the trait `Sync` is not implemented for `*const cxx::void`
= note: required because it appears within the type `[*const cxx::void; 0]`
= note: required because it appears within the type `cxx::private::Opaque`
note: required because it appears within the type `ffi::Opaque`
--> tests/ui/opaque_autotraits.rs:4:14
|
4 | type Opaque;
| ^^^^^^
note: required by a bound in `assert_sync`
--> tests/ui/opaque_autotraits.rs:9:19
|
9 | fn assert_sync<T: Sync>() {}
| ^^^^ required by this bound in `assert_sync`
error[E0277]: `PhantomPinned` cannot be unpinned
--> tests/ui/opaque_autotraits.rs:15:20
|
15 | assert_unpin::<ffi::Opaque>();
| ^^^^^^^^^^^ within `ffi::Opaque`, the trait `Unpin` is not implemented for `PhantomPinned`
|
= note: consider using `Box::pin`
= note: required because it appears within the type `PhantomData<PhantomPinned>`
= note: required because it appears within the type `cxx::private::Opaque`
note: required because it appears within the type `ffi::Opaque`
--> tests/ui/opaque_autotraits.rs:4:14
|
4 | type Opaque;
| ^^^^^^
note: required by a bound in `assert_unpin`
--> tests/ui/opaque_autotraits.rs:10:20
|
10 | fn assert_unpin<T: Unpin>() {}
| ^^^^^ required by this bound in `assert_unpin`

10
vendor/cxx/tests/ui/opaque_not_sized.rs vendored Normal file
View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
type TypeR;
}
}
struct TypeR(str);
fn main() {}

View file

@ -0,0 +1,17 @@
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> tests/ui/opaque_not_sized.rs:4:14
|
4 | type TypeR;
| ^^^^^ doesn't have a size known at compile-time
|
= help: within `TypeR`, the trait `Sized` is not implemented for `str`
note: required because it appears within the type `TypeR`
--> tests/ui/opaque_not_sized.rs:8:8
|
8 | struct TypeR(str);
| ^^^^^
note: required by a bound in `__AssertSized`
--> tests/ui/opaque_not_sized.rs:4:9
|
4 | type TypeR;
| ^^^^^^^^^^^ required by this bound in `__AssertSized`

14
vendor/cxx/tests/ui/pin_mut_opaque.rs vendored Normal file
View file

@ -0,0 +1,14 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type Opaque;
fn f(arg: &mut Opaque);
fn g(&mut self);
fn h(self: &mut Opaque);
fn s(s: &mut CxxString);
fn v(v: &mut CxxVector<u8>);
}
}
fn main() {}

View file

@ -0,0 +1,35 @@
error: mutable reference to C++ type requires a pin -- use Pin<&mut Opaque>
--> tests/ui/pin_mut_opaque.rs:5:19
|
5 | fn f(arg: &mut Opaque);
| ^^^^^^^^^^^
error: mutable reference to C++ type requires a pin -- use Pin<&mut CxxString>
--> tests/ui/pin_mut_opaque.rs:8:17
|
8 | fn s(s: &mut CxxString);
| ^^^^^^^^^^^^^^
error: mutable reference to C++ type requires a pin -- use Pin<&mut CxxVector<...>>
--> tests/ui/pin_mut_opaque.rs:9:17
|
9 | fn v(v: &mut CxxVector<u8>);
| ^^^^^^^^^^^^^^^^^^
error: needs a cxx::ExternType impl in order to be used as a non-pinned mutable reference in signature of `f`, `g`, `h`
--> tests/ui/pin_mut_opaque.rs:4:9
|
4 | type Opaque;
| ^^^^^^^^^^^
error: mutable reference to opaque C++ type requires a pin -- use `self: Pin<&mut Opaque>`
--> tests/ui/pin_mut_opaque.rs:6:14
|
6 | fn g(&mut self);
| ^^^^^^^^^
error: mutable reference to opaque C++ type requires a pin -- use `self: Pin<&mut Opaque>`
--> tests/ui/pin_mut_opaque.rs:7:20
|
7 | fn h(self: &mut Opaque);
| ^^^^^^^^^^^

8
vendor/cxx/tests/ui/ptr_in_fnptr.rs vendored Normal file
View file

@ -0,0 +1,8 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
fn f(callback: fn(p: *const u8));
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: pointer argument requires that the function pointer be marked unsafe
--> tests/ui/ptr_in_fnptr.rs:4:27
|
4 | fn f(callback: fn(p: *const u8));
| ^^^^^^^^^^^^

View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type C;
fn not_unsafe_ptr(c: *mut C);
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: pointer argument requires that the function be marked unsafe
--> tests/ui/ptr_missing_unsafe.rs:6:27
|
6 | fn not_unsafe_ptr(c: *mut C);
| ^^^^^^^^^

10
vendor/cxx/tests/ui/ptr_no_const_mut.rs vendored Normal file
View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type C;
fn get_neither_const_nor_mut() -> *C;
}
}
fn main() {}

View file

@ -0,0 +1,18 @@
error: expected `mut` or `const` keyword in raw pointer type
--> tests/ui/ptr_no_const_mut.rs:6:43
|
6 | fn get_neither_const_nor_mut() -> *C;
| ^
|
help: add `mut` or `const` here
|
6 | fn get_neither_const_nor_mut() -> *const C;
| +++++
6 | fn get_neither_const_nor_mut() -> *mut C;
| +++
error: expected `const` or `mut`
--> tests/ui/ptr_no_const_mut.rs:6:44
|
6 | fn get_neither_const_nor_mut() -> *C;
| ^

12
vendor/cxx/tests/ui/ptr_unsupported.rs vendored Normal file
View file

@ -0,0 +1,12 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type C;
fn get_ptr_to_reference() -> *mut &C;
fn get_uniqueptr_to_ptr() -> UniquePtr<*mut C>;
fn get_vector_of_ptr() -> UniquePtr<CxxVector<*mut C>>;
}
}
fn main() {}

View file

@ -0,0 +1,17 @@
error: C++ does not allow pointer to reference as a type
--> tests/ui/ptr_unsupported.rs:6:38
|
6 | fn get_ptr_to_reference() -> *mut &C;
| ^^^^^^^
error: unsupported unique_ptr target type
--> tests/ui/ptr_unsupported.rs:7:38
|
7 | fn get_uniqueptr_to_ptr() -> UniquePtr<*mut C>;
| ^^^^^^^^^^^^^^^^^
error: unsupported vector element type
--> tests/ui/ptr_unsupported.rs:8:45
|
8 | fn get_vector_of_ptr() -> UniquePtr<CxxVector<*mut C>>;
| ^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,53 @@
use cxx::{type_id, ExternType};
#[repr(transparent)]
pub struct QuotedRaw(usize);
unsafe impl ExternType for QuotedRaw {
type Id = type_id!("org::r#box::implementation::QuotedRaw");
type Kind = cxx::kind::Trivial;
}
#[repr(transparent)]
pub struct QuotedKeyword(usize);
unsafe impl ExternType for QuotedKeyword {
type Id = type_id!("org::box::implementation::QuotedKeyword");
type Kind = cxx::kind::Trivial;
}
#[repr(transparent)]
pub struct UnquotedRaw(usize);
unsafe impl ExternType for UnquotedRaw {
type Id = type_id!(org::r#box::implementation::UnquotedRaw);
type Kind = cxx::kind::Trivial;
}
#[repr(transparent)]
pub struct UnquotedKeyword(usize);
unsafe impl ExternType for UnquotedKeyword {
type Id = type_id!(org::box::implementation::UnquotedKeyword);
type Kind = cxx::kind::Trivial;
}
#[cxx::bridge]
pub mod ffi {
extern "C++" {
#[namespace = "org::r#box::implementation"]
type QuotedRaw = crate::QuotedRaw;
#[namespace = "org::box::implementation"]
type QuotedKeyword = crate::QuotedKeyword;
#[namespace = org::r#box::implementation]
type UnquotedRaw = crate::UnquotedRaw;
// Not allowed by rustc (independent of cxx):
// #[namespace = org::box::implementation]
// type UnquotedKeyword = crate::UnquotedKeyword;
}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: raw identifier `r#box` is not allowed in a quoted namespace; use `box`, or remove quotes
--> tests/ui/raw_ident_namespace.rs:7:24
|
7 | type Id = type_id!("org::r#box::implementation::QuotedRaw");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: raw identifier `r#box` is not allowed in a quoted namespace; use `box`, or remove quotes
--> tests/ui/raw_ident_namespace.rs:38:23
|
38 | #[namespace = "org::r#box::implementation"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,13 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type ThingC;
fn repro_c(t: &&ThingC);
}
extern "Rust" {
type ThingR;
fn repro_r(t: &&ThingR);
}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: C++ does not allow references to references
--> tests/ui/reference_to_reference.rs:5:23
|
5 | fn repro_c(t: &&ThingC);
| ^^^^^^^^
error: C++ does not allow references to references
--> tests/ui/reference_to_reference.rs:9:23
|
9 | fn repro_r(t: &&ThingR);
| ^^^^^^^^

View file

@ -0,0 +1,10 @@
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
type Logger;
fn logger<'static>() -> Pin<&'static Logger>;
}
}
fn main() {}

View file

@ -0,0 +1,5 @@
error[E0262]: invalid lifetime parameter name: `'static`
--> tests/ui/reserved_lifetime.rs:6:19
|
6 | fn logger<'static>() -> Pin<&'static Logger>;
| ^^^^^^^ 'static is a reserved lifetime name

16
vendor/cxx/tests/ui/reserved_name.rs vendored Normal file
View file

@ -0,0 +1,16 @@
#[cxx::bridge]
mod ffi {
struct UniquePtr {
val: usize,
}
extern "C++" {
type Box;
}
extern "Rust" {
type String;
}
}
fn main() {}

View file

@ -0,0 +1,17 @@
error: reserved name
--> tests/ui/reserved_name.rs:3:12
|
3 | struct UniquePtr {
| ^^^^^^^^^
error: reserved name
--> tests/ui/reserved_name.rs:8:14
|
8 | type Box;
| ^^^
error: reserved name
--> tests/ui/reserved_name.rs:12:14
|
12 | type String;
| ^^^^^^

View file

@ -0,0 +1,14 @@
#[cxx::bridge]
mod ffi {
extern "Rust" {
fn f() -> Result<()>;
}
}
pub struct NonError;
fn f() -> Result<(), NonError> {
Ok(())
}
fn main() {}

View file

@ -0,0 +1,8 @@
error[E0277]: `NonError` doesn't implement `std::fmt::Display`
--> tests/ui/result_no_display.rs:4:19
|
4 | fn f() -> Result<()>;
| ^^^^^^^^^^ `NonError` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `NonError`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

Some files were not shown because too many files have changed in this diff Show more