Closed as not planned
Closed as not planned
Description
I tried this code:
#[derive(Clone)]
pub struct Foo;
#[derive(Clone)]
#[repr(packed)]
pub struct Bar(Foo);
I expected to see this happen: A deny-by-default unaligned_references
lint (or similar) in Rust 1.68.2, and a hard error in Rust 1.69.0.
Instead, this happened: No lint in Rust 1.68.2, and a hard error in Rust 1.69.0:
error[E0507]: cannot move out of `self` which is behind a shared reference
--> src/lib.rs:6:16
|
4 | #[derive(Clone)]
| ----- in this derive macro expansion
5 | #[repr(packed)]
6 | pub struct Bar(Foo);
| ^^^ move occurs because `self.0` has type `Foo`, which does not implement the `Copy` trait
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
(This issue was originally reported by @UncombedCoconut, who found that the bbchallenge decider-finite-automata-reduction
crate no longer compiles in 1.69.0, due to the use of derive macros on a packed struct.)
Meta
rustc --version --verbose
:
rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.7