Skip to content

feat: emit async modifier for functions returning impl Future#22410

Open
Albab-Hasan wants to merge 1 commit into
rust-lang:masterfrom
Albab-Hasan:async-modifier-impl-future
Open

feat: emit async modifier for functions returning impl Future#22410
Albab-Hasan wants to merge 1 commit into
rust-lang:masterfrom
Albab-Hasan:async-modifier-impl-future

Conversation

@Albab-Hasan
Copy link
Copy Markdown
Contributor

the async semantic token modifier was only emitted for async fn. functions in embedded async crates like embassy commonly return impl Future or a concrete type that implements Future without the async keyword.

returns_impl_future in hir is extended to fall through to an impls_trait check when the return type is not impl Trait syntax covering concrete structs and type aliases that implement Future. the Sized lang item is optional in the impl Trait path; not a hard failure so its absence in minimal crate environments dosent silently return false.

closes #22407

the `async` semantic token modifier was only emitted for `async fn`. functions in embedded async crates like embassy commonly return `impl Future` or a concrete type that implements `Future` without the `async` keyword, causing inconsistent highlighting.

`returns_impl_future` in `hir` is extended to fall through to an `impls_trait` check when the return type is not `impl
Trait` syntax, covering concrete structs and type aliases that implement `Future`. the `Sized` lang item is now treated
as optional in the impl Trait path rather than a hard failure, so its absence in minimal crate environments no longer
silently returns false.

closes rust-lang#22407
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2026
@ChayimFriedman2
Copy link
Copy Markdown
Contributor

I object. These functions are not declared async, and hover should be faithful.

@Albab-Hasan
Copy link
Copy Markdown
Contributor Author

fair

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2026
@Albab-Hasan
Copy link
Copy Markdown
Contributor Author

@ChayimFriedman2 can you take a look at this pls

#21908

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

Hmm, now I see that this is not about hover but about highlighting. So maybe, I need to form an opinion on this.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit semantic token modifier async for impl Future

3 participants