{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreidiuzrmmlxe3o6yalizpdki6jf2dhotyxnwasr7vwoemh7j6h3c5i",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mnqpabmtnb52"
},
"path": "/t/for-structs-that-have-fields-that-have-only-one-possible-representation-enums-should-use-that-field-as-the-discriminant/24382#post_6",
"publishedAt": "2026-06-08T01:53:05.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.Variants.html#variant.Multiple.field.tag_field"
],
"textContent": "kpreid:\n\n> It is similar to the case of wanting to collapse two non-overlapping enums:\n\nThis is a harder problem, because it requires _range_ discriminants.\n\nIf there's one spot with a _single_ value per variant, that's something that could \"just work\" already if the layout algorithm can find it and put it in the https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.Variants.html#variant.Multiple.field.tag_field.",
"title": "For structs that have fields that have only one possible representation, enums should use that field as the discriminant"
}