Add ui test of derives that fail due to field types

This commit is contained in:
David Tolnay 2020-11-27 12:24:22 -08:00
parent b247df1d26
commit 4d73379753
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
4 changed files with 42 additions and 0 deletions

View File

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

View File

@ -0,0 +1,8 @@
error[E0277]: the trait bound `ffi::Other: Clone` is not satisfied
--> $DIR/derive_nonclone.rs:1:1
|
1 | #[cxx::bridge]
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `ffi::Other`
|
= note: required by `clone`
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

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,8 @@
error[E0204]: the trait `Copy` may not be implemented for this type
--> $DIR/derive_noncopy.rs:3:14
|
3 | #[derive(Copy)]
| ^^^^
4 | struct TryCopy {
5 | other: Other,
| ------------ this field does not implement `Copy`