limit packed copy-out to non-generic Copy structs

This commit is contained in:
Ariel Ben-Yehuda 2017-11-19 17:04:24 +02:00 committed by Ariel Ben-Yehuda
parent dee8a71cd5
commit 617b413e18
7 changed files with 123 additions and 15 deletions

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(safe_packed_borrows)]
// check that derive on a packed struct with non-Copy fields
// correctly. This can't be made to work perfectly because
// we can't just use the field from the struct as it might
@ -17,12 +19,10 @@
struct Y(usize);
#[derive(PartialEq)]
//~^ ERROR cannot move out of borrowed
//~| ERROR cannot move out of borrowed
//~| ERROR cannot move out of borrowed
//~| ERROR cannot move out of borrowed
#[repr(packed)]
struct X(Y);
//~^ ERROR #[derive] can't be used on a non-Copy #[repr(packed)]
//~| hard error
fn main() {
}