Skip to content

Commit

Permalink
Auto merge of #121346 - m-ou-se:temp-lifetime-if-else-match, r=compil…
Browse files Browse the repository at this point in the history
…er-errors

Propagate temporary lifetime extension into if and match.

This PR makes this work:

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

and

```rust
let a = match () {
    _ => {
        ..;
        &temp() // used to error, but now gets lifetime extended
    }
};
```

to make it consistent with:

```rust
let a = {
    ..;
    &temp() // lifetime is extended
};
```

This is one small part of [the temporary lifetimes work](rust-lang/lang-team#253).

This part is backwards compatible (so doesn't need be edition-gated), because all code affected by this change previously resulted in a hard error.
  • Loading branch information
bors committed Apr 10, 2024
2 parents b73983f + a26ff13 commit 977d0b6
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 977d0b6

Please sign in to comment.