about summary refs log tree commit diff
path: root/tests/codegen/function-arguments.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-10 18:52:51 +0000
committerbors <bors@rust-lang.org>2024-04-10 18:52:51 +0000
commitb3bd7058c139e71bae0862ef8f8ac936208873e9 (patch)
treeb74588beab0654ccb6c6c343427929f434bf681f /tests/codegen/function-arguments.rs
parentc2239bca5b89a8d3573cc0fc0f2fa65c50edb79c (diff)
parentf4caa832dad4482ec1fa85bdbc3156c83cc948de (diff)
downloadrust-b3bd7058c139e71bae0862ef8f8ac936208873e9.tar.gz
rust-b3bd7058c139e71bae0862ef8f8ac936208873e9.zip
Auto merge of #121346 - m-ou-se:temp-lifetime-if-else-match, r=compiler-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](https://github.com/rust-lang/lang-team/issues/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.
Diffstat (limited to 'tests/codegen/function-arguments.rs')
0 files changed, 0 insertions, 0 deletions