Skip to content

[MIR] Loop bodies should not have destination of any sort #30636

Closed
@nagisa

Description

@nagisa

Loop bodies are not supposed to have destination (loops, on the other hand, may), but since MIR code generates all blocks the same way, it results in an artefact of a never-used dummy assignment in MIR for some loops like:

loop { () }

or

while 1 == 2 { () }

foo

Probably the best thing to do here would be to have a different ExprKind for loop bodies and ignore “returns” from blocks there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-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