Skip to content

Commit 5c37473

Browse files
Specify that packed types must derive, not implement, Copy
1 parent 1b3d737 commit 5c37473

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/librustc_mir/transform/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D
362362
format!("#[derive] can't be used on a #[repr(packed)] struct with \
363363
type parameters (error E0133)")
364364
} else {
365-
format!("#[derive] can't be used on a non-Copy #[repr(packed)] struct \
366-
(error E0133)")
365+
format!("#[derive] can't be used on a #[repr(packed)] struct that \
366+
does not derive Copy (error E0133)")
367367
};
368368
tcx.lint_node(SAFE_PACKED_BORROWS,
369369
lint_node_id,

src/test/ui/deriving-with-repr-packed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct Bar(u32, u32, u32);
3333
struct Y(usize);
3434

3535
#[derive(PartialEq)]
36-
//~^ ERROR #[derive] can't be used on a non-Copy #[repr(packed)]
36+
//~^ ERROR #[derive] can't be used
3737
//~| hard error
3838
#[repr(packed)]
3939
struct X(Y);

src/test/ui/deriving-with-repr-packed.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LL | #[derive(Copy, Clone, PartialEq, Eq)]
2121
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2222
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
2323

24-
error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133)
24+
error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133)
2525
--> $DIR/deriving-with-repr-packed.rs:26:10
2626
|
2727
LL | #[derive(PartialEq, Eq)]
@@ -30,7 +30,7 @@ LL | #[derive(PartialEq, Eq)]
3030
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3131
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
3232

33-
error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133)
33+
error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133)
3434
--> $DIR/deriving-with-repr-packed.rs:35:10
3535
|
3636
LL | #[derive(PartialEq)]

0 commit comments

Comments
 (0)