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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nellshamrell/improve async error #86705
Nellshamrell/improve async error #86705
Changes from 2 commits
93ef6b3
0ec98df
686eaf4
0f05538
4eddf27
11dccad
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the diagnostic is saying that
Test
is a future. Could we instead say something like 'an async function returns a future that outputs the written return type'?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could highlight the entire function signature and say something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To better support macros, I think we should keep pointing to the return type, but mention the function name in the error message. This will produce a nicer message when the return type tokens are constructed separately (e.g. a type passed into a
macro_rules!
macro).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion - any pointers on how to surface the function name in the error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look conveniently accessible at the moment. Maybe @estebank has a suggestion on the cleanest way to get the name of the desugared async function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://github.com/rust-lang/rust/pull/86705/files#diff-845d26194de711d60e1317dbe90812d5d7635f4f758222fd7e14bf550ffe895dL1522 we have the
DefId
of the opaque type. With it I think you can get the def id of the parentfn
, and calldef_path
on that, but I don't have the codebase at hand now to be more specific. I can help you nell either tomorrow or on thursday.