Skip to content

Suggest add async for function sig with return expr in body - #160663

Open
chenyukang wants to merge 1 commit into
rust-lang:mainfrom
chenyukang:yukang-fix-159495-suggest-async-return-future
Open

Suggest add async for function sig with return expr in body#160663
chenyukang wants to merge 1 commit into
rust-lang:mainfrom
chenyukang:yukang-fix-159495-suggest-async-return-future

Conversation

@chenyukang

@chenyukang chenyukang commented Aug 7, 2026

Copy link
Copy Markdown
Member

Fixes #159495

r? @estebank

@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 Aug 7, 2026
@chenyukang
chenyukang force-pushed the yukang-fix-159495-suggest-async-return-future branch from 1ba96e4 to d7a0654 Compare August 7, 2026 01:24
@chenyukang
chenyukang force-pushed the yukang-fix-159495-suggest-async-return-future branch from d7a0654 to aed866a Compare August 7, 2026 01:38
error[E0308]: mismatched types
--> $DIR/suggest-async-fn-for-returned-future-ineligible-issue-159495.rs:12:20
|
LL | let _: i32 = { number() };

@estebank estebank Aug 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if having a help saying "if the function was async, you could await" would make sense for some subset of cases that we are less certain of.

View changes since the review

@estebank

estebank commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit aed866a has been approved by estebank

It is now in the queue for this repository.

@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 Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggest making fn async if future found in return expr

3 participants