Rollup merge of #63374 - RalfJung:pin-packed, r=cramertj
move of packed fields might or might not occur when they actually are sufficiently aligned
See https://github.com/taiki-e/pin-project/pull/34, where it was pointed out that we actually don't move fields of 1-aligned types when dropping a packed struct -- but e.g. in a `packed(2)` struct, we don't do something similar for 2-aligned types. The code for that is [here](db7c773a6b/src/librustc_mir/util/alignment.rs (L7)
).
This commit is contained in:
commit
432b55e457
1 changed files with 2 additions and 1 deletions
|
@ -188,7 +188,8 @@
|
|||
//! you do not accidentally use `self`/`this` in a way that is in conflict with pinning.
|
||||
//!
|
||||
//! Moreover, if your type is `#[repr(packed)]`, the compiler will automatically
|
||||
//! move fields around to be able to drop them. As a consequence, you cannot use
|
||||
//! move fields around to be able to drop them. It might even do
|
||||
//! that for fields that happen to be sufficiently aligned. As a consequence, you cannot use
|
||||
//! pinning with a `#[repr(packed)]` type.
|
||||
//!
|
||||
//! # Projections and Structural Pinning
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue