Skip to content

Clean up cast categorization #97649

Open
Open
@RalfJung

Description

@RalfJung

Currently, our classification of casts is kind of a mess:

  • We have mir::CastKind, but it has a Misc variant and most casts fall in that category (this is what ends up in the MIR).
  • We also have ty::cast::CastKind that has a seemingly independent classification (no idea where this is used).
  • We have a CastTy type, but can it really represent all types in a cast? If yes, I'd expect to see unwraps around here.
  • In thir::ExprKind, we have Cast and Pointer expressions, the latter also being casts.

I don't know how these all relate, but it looks like some cleanup is dearly necessary here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-technical-debtArea: Internal cleanup workC-cleanupCategory: PRs that clean code up or issues documenting cleanup.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