```
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
added
S-waiting-on-review
labels
Jul 13, 2026
rust-bors
Bot
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Jul 14, 2026Merged
rust-bors Bot pushed a commit that referenced this pull request
Jul 15, 2026Rollup 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-timer added a commit that referenced this pull request
Jul 15, 2026Rollup 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` ```