Skip to content

Settle execution order uncertainty for += #28160

Closed
@nikomatsakis

Description

@nikomatsakis

When translating something like a += b to MIR, an uncertainty arose about what the semantics of

a = 0;
a += { a = 22; 2 }

ought to be. Should resulting value of a be 24 or 2, basically? The current MIR yields 24, on the basis that this is more-or-less what will happen in the case of overloading as well (presuming non-lexical lifetimes, since I think otherwise you get a borrowck error).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCP-mediumMedium priorityT-langRelevant to the language 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