Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robustify the TyKind ambig/unambig layout compatibility tests #135944

Open
compiler-errors opened this issue Jan 23, 2025 · 1 comment
Open

Robustify the TyKind ambig/unambig layout compatibility tests #135944

compiler-errors opened this issue Jan 23, 2025 · 1 comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@compiler-errors
Copy link
Member

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.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 23, 2025
@compiler-errors
Copy link
Member Author

cc @BoxyUwU may have more info here. no obligation for you to work on it, but maybe a good beginner issue.

@fmease fmease added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants