-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
I think we probably should track some follow-up work with fleshing out the type layout test to make sure we don't accidentally start fucking up the transmute between
Unambig = ()andUnambig = !, though I also expect that that would end up causing segfaults in the compiler immediately. I'll file something for that.
Originally posted by @compiler-errors in #135272 (comment)
#135272 introduced a very interesting trick where we transmute between two variants of hir::TyKind<U> -- namely hir::TyKind<()> and hir::TyKind<!> -- to represent the presence or not of a variant of TyKind::Infer which is superseded in certain contexts by a more general infer kind that is shared between consts and types.
As of that PR landing, there's a test (compiler/rustc_hir/src/lib.rs) that exercises the layout compatibility between these TyKinds, but it could be fleshed out some more.