diff options
author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-11-21 11:48:25 +1100 |
---|---|---|
committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-11-21 14:07:39 +1100 |
commit | a6e09a19fc20cdf9043e1b856d15170ac0f96511 (patch) | |
tree | 14e738619da822f4b4958d4fa3ba88b406d01cdb /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs | |
parent | a28f3c88e50a77bc2a91889241248c4543854e61 (diff) | |
download | rust-a6e09a19fc20cdf9043e1b856d15170ac0f96511.tar.gz |
Streamline deriving on packed structs.
The current approach to field accesses in derived code:
- Normal case: `&self.0`
- In a packed struct that derives `Copy`: `&{self.0}`
- In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self`
The `let` pattern used in the third case is equivalent to the simpler
field access in the first case. This commit changes the third case to
use a field access.
The commit also combines two boolean arguments (`is_packed` and
`always_copy`) into a single field (`copy_fields`) earlier, to save
passing both around.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions