{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiemz7cxbin5uil2rtix36e7ecqrltn2q6gcv45m4n4mf2ed34jy4u",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mmecovrnzfa2"
},
"path": "/t/pre-rfc-improved-ergonomics-for/24336#post_9",
"publishedAt": "2026-05-19T14:59:32.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "MusicalNinjaDad:\n\n> (I just realise I'd overread what might be a typo ... assuming you meant coercing to a general _`UninhabitedErr<T,E>`_ ...)\n\nYup, that’s a typo.\n\nYour example is roughly what I’m thinking of (aside from shortening the fairly-arbitrary list of invariants).\n\nAs for relying on `Try`… it seems like implementing this mapping/coercion would get very overengineered.\n\nWould it be better to make this less generic, and focus on providing mapping functions to individual types? How many `std` types and how many non-`std` types do you wish had more mapping functions?\n\nYou also dislike using `|x| x` to coerce `!`; perhaps defining the following function somewhere in each of your crates would suffice?\n\n\n fn never<T>(never: !) -> T {\n never\n }\n\n\nDoing `.map_ok(never)` seems fairly clear to me. (Or `.map_ok(coerce_never)`, etc.)",
"title": "Pre-RFC improved ergonomics for `!`"
}