feat: emit async modifier for functions returning impl Future#22410
Open
Albab-Hasan wants to merge 1 commit into
Open
feat: emit async modifier for functions returning impl Future#22410Albab-Hasan wants to merge 1 commit into
Albab-Hasan wants to merge 1 commit into
Conversation
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
Contributor
|
I object. These functions are not declared async, and hover should be faithful. |
Contributor
Author
|
fair |
Contributor
Author
|
@ChayimFriedman2 can you take a look at this pls |
Contributor
|
Hmm, now I see that this is not about hover but about highlighting. So maybe, I need to form an opinion on this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the
asyncsemantic token modifier was only emitted forasync fn. functions in embedded async crates like embassy commonly returnimpl Futureor a concrete type that implementsFuturewithout theasynckeyword.returns_impl_futureinhiris extended to fall through to animpls_traitcheck when the return type is notimpl Traitsyntax covering concrete structs and type aliases that implementFuture. theSizedlang 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