mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-23 09:30:45 +00:00
Add ui test of derives that fail due to field types
This commit is contained in:
parent
b247df1d26
commit
4d73379753
13
tests/ui/derive_nonclone.rs
Normal file
13
tests/ui/derive_nonclone.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#[cxx::bridge]
|
||||
mod ffi {
|
||||
#[derive(Clone)]
|
||||
struct TryClone {
|
||||
other: Other,
|
||||
}
|
||||
|
||||
struct Other {
|
||||
x: usize,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
8
tests/ui/derive_nonclone.stderr
Normal file
8
tests/ui/derive_nonclone.stderr
Normal 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)
|
13
tests/ui/derive_noncopy.rs
Normal file
13
tests/ui/derive_noncopy.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#[cxx::bridge]
|
||||
mod ffi {
|
||||
#[derive(Copy)]
|
||||
struct TryCopy {
|
||||
other: Other,
|
||||
}
|
||||
|
||||
struct Other {
|
||||
x: usize,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
8
tests/ui/derive_noncopy.stderr
Normal file
8
tests/ui/derive_noncopy.stderr
Normal 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`
|
Loading…
x
Reference in New Issue
Block a user