diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-05-28 17:54:12 -0600 |
|---|---|---|
| committer | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-06-02 07:24:34 -0600 |
| commit | 5c374739b679612c2fe8d033b0607beb14a5c4d3 (patch) | |
| tree | b4c897bdd37d44e4db6cd954d2bf2a28199f40f7 | |
| parent | 1b3d737716a4ae40709da627fc3e726ce539e405 (diff) | |
| download | rust-5c374739b679612c2fe8d033b0607beb14a5c4d3.tar.gz rust-5c374739b679612c2fe8d033b0607beb14a5c4d3.zip | |
Specify that packed types must derive, not implement, Copy
| -rw-r--r-- | src/librustc_mir/transform/check_unsafety.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/deriving-with-repr-packed.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/deriving-with-repr-packed.stderr | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index fedd0774df4..4c282f037a5 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -362,8 +362,8 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D format!("#[derive] can't be used on a #[repr(packed)] struct with \ type parameters (error E0133)") } else { - format!("#[derive] can't be used on a non-Copy #[repr(packed)] struct \ - (error E0133)") + format!("#[derive] can't be used on a #[repr(packed)] struct that \ + does not derive Copy (error E0133)") }; tcx.lint_node(SAFE_PACKED_BORROWS, lint_node_id, diff --git a/src/test/ui/deriving-with-repr-packed.rs b/src/test/ui/deriving-with-repr-packed.rs index 0c52829799e..43375098cb5 100644 --- a/src/test/ui/deriving-with-repr-packed.rs +++ b/src/test/ui/deriving-with-repr-packed.rs @@ -33,7 +33,7 @@ pub struct Bar(u32, u32, u32); struct Y(usize); #[derive(PartialEq)] -//~^ ERROR #[derive] can't be used on a non-Copy #[repr(packed)] +//~^ ERROR #[derive] can't be used //~| hard error #[repr(packed)] struct X(Y); diff --git a/src/test/ui/deriving-with-repr-packed.stderr b/src/test/ui/deriving-with-repr-packed.stderr index 64aefbcd5df..a7599c1e7db 100644 --- a/src/test/ui/deriving-with-repr-packed.stderr +++ b/src/test/ui/deriving-with-repr-packed.stderr @@ -21,7 +21,7 @@ LL | #[derive(Copy, Clone, PartialEq, Eq)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043> -error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133) +error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133) --> $DIR/deriving-with-repr-packed.rs:26:10 | LL | #[derive(PartialEq, Eq)] @@ -30,7 +30,7 @@ LL | #[derive(PartialEq, Eq)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043> -error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133) +error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133) --> $DIR/deriving-with-repr-packed.rs:35:10 | LL | #[derive(PartialEq)] |
