Skip to content

Robustify the TyKind ambig/unambig layout compatibility tests #135944

Open
@compiler-errors

Description

@compiler-errors

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 = () and Unambig = !, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions