Skip to content

Propagate temporary lifetime extension into if and match expressions #1548

@xmh0511

Description

@xmh0511

Since 1.79, the temporaries are extended in the following example:

let a = if true {
    ..;
    &temp() // used to error, but now gets lifetime extended
} else {
    ..;
    &temp() // used to error, but now gets lifetime extended
};

The list in extending-based-on-expressions seems to be out-of-date.

Activity

ehuss

ehuss commented on Jul 26, 2024

@ehuss
Contributor

cc rust-lang/rust#121346. @m-ou-se would you be able to help with that?

added
A-destructorsArea: destructors, dropping
New ContentMissing features or aspects of language not currently documented.
on Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-destructorsArea: destructors, droppingNew ContentMissing features or aspects of language not currently documented.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ehuss@xmh0511

        Issue actions

          Propagate temporary lifetime extension into if and match expressions · Issue #1548 · rust-lang/reference