Specify that packed types must derive, not implement, Copy
This commit is contained in:
parent
1b3d737716
commit
5c374739b6
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user