rustbot · GitHub

```
error: lifetime may not live long enough
  --> $DIR/higher-ranked-return.rs:11:46
   |
LL |           let x = async move |x: &str| -> &str {
   |  ________________________________-________-____^
   | |                                |        |
   | |                                |        let's call the lifetime of this reference `'2`
   | |                                let's call the lifetime of this reference `'1`
LL | |             x
LL | |         };
   | |_________^ returning this value requires that `'1` must outlive `'2`
```
instead of
```
error: lifetime may not live long enough
  --> $DIR/higher-ranked-return.rs:11:46
   |
LL |           let x = async move |x: &str| -> &str {
   |  ________________________________-________----_^
   | |                                |        |
   | |                                |        return type of async closure `{async closure body@$DIR/higher-ranked-return.rs:11:46: 13:10}` contains a lifetime `'2`
   | |                                let's call the lifetime of this reference `'1`
LL | |             x
LL | |         };
   | |_________^ returning this value requires that `'1` must outlive `'2`
```

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Jul 13, 2026

@rust-bors rust-bors Bot added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jul 14, 2026

Merged

rust-bors Bot pushed a commit that referenced this pull request

Jul 15, 2026
Rollup of 15 pull requests
Successful merges:
 - #159311 (Add 1.97.1 release notes)
 - #156220 (Implement `VecDeque::truncate_to_range`)
 - #158608 (Implement `#[diagnostic::opaque]` attribute to hide backtraces of macros.)
 - #159168 (Fix static_mut_refs lint check logic)
 - #159242 (resolve: Inherit eager invocation parents)
 - #159256 (Account for async closures when pointing at lifetime in return type)
 - #159310 (cleanup: upstream dropped AMX-TF32)
 - #158348 (Add documentation for the `inline` attribute)
 - #159181 (add rustc_no_writable to mem::forget and structs it uses)
 - #159191 (Mark `PrivateItems` with `std_internals` unstable feature.)
 - #159194 (rustdoc: Fix auto trait normalization env)
 - #159196 (OnceCell: Improve wording in module docs)
 - #159289 (Fix Zulip backport command suggestion)
 - #159294 (renovate: don't update PRs in the merge queue)
 - #159305 (std: clarify available_parallelism docs for Windows 11 processor groups)

@rust-bors

rust-timer added a commit that referenced this pull request

Jul 15, 2026
Rollup merge of #159256 - estebank:coroutine-ret-ty, r=workingjubilee
Account for async closures when pointing at lifetime in return type
```
error: lifetime may not live long enough
  --> $DIR/higher-ranked-return.rs:11:46
   |
LL |           let x = async move |x: &str| -> &str {
   |  ________________________________-________-____^
   | |                                |        |
   | |                                |        let's call the lifetime of this reference `'2`
   | |                                let's call the lifetime of this reference `'1`
LL | |             x
LL | |         };
   | |_________^ returning this value requires that `'1` must outlive `'2`
```
instead of
```
error: lifetime may not live long enough
  --> $DIR/higher-ranked-return.rs:11:46
   |
LL |           let x = async move |x: &str| -> &str {
   |  ________________________________-________----_^
   | |                                |        |
   | |                                |        return type of async closure `{async closure body@$DIR/higher-ranked-return.rs:11:46: 13:10}` contains a lifetime `'2`
   | |                                let's call the lifetime of this reference `'1`
LL | |             x
LL | |         };
   | |_________^ returning this value requires that `'1` must outlive `'2`
```

pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request

Jul 16, 2026

Read the original on github.com ↗