{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreies54fa5mbfan6ig7jqvccpudo4ytqgqnp42pfku6xxfug5kpagke",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mg6mownqaex2"
},
"path": "/t/f-pattern-types-subsets-enums-using-as/24048#post_16",
"publishedAt": "2026-03-03T18:39:04.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "scottmcm:\n\n> The hard question is whether `Result<T, MyErrorSubset>` can actually be any smaller if it's defined that way.\n\nIn my opinion, the main benefit to pattern types is in exhaustiveness checking in e.g. `match` constructs and other static guarantees, though it'll be a nice extra if e.g. `Result<NonZeroU32, MyError is MyError::NotFound>` gets optimized to the same size as a `u32`. An initial implementation which handles the language semantics, but leaving open optimization opportunities for later, would be good enough for me to be happy.",
"title": "F-pattern_types : Subsets enums using as"
}