rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.75k stars 258 forks source link

doc: improve documentation of packed type layout modifier #318

Open phip1611 opened 2 years ago

phip1611 commented 2 years ago

~The Rust language reference (and my experience, proved by tests) says, that packed(n) gives you the ability to align the struct too. This bug probably comes from a past version of Rust, where this wasn't supported.~

Currently, the packed documentation doesn't mention the n-parameter.

https://doc.rust-lang.org/reference/type-layout.html

phip1611 commented 2 years ago

I updated the PR @ehuss . See the latest version here: https://github.com/rust-lang/nomicon/blob/20d86cd0331e1c54bfd85e25326e3e0e41fc979e/src/other-reprs.md

Any more comments?

phip1611 commented 2 years ago

Sorry for the circumstances on this, I obviously understood something wrong. I tried to improve the description in a way, that others will not fall for the same misleading assumption as me. @ehuss

phip1611 commented 2 years ago

@ehuss I rebased the PR branch onto the latest master branch.