-
Notifications
You must be signed in to change notification settings - Fork 13.4k
diagnostic for naive recursive async functions is really unfriendly #62539
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@rustbot claim |
I think an error like
|
In addition to adding specific output for async fn, it would also be good to stop outputing "self-referential type" in any context, and instead use "recursive type" as this error message does at one point. Nowadays, "self-referential" is used very often to mean they have references pointing into themselves, rather than how it is being used here, and someone who googles it will get very unhelpful results. I imagine this fix would just be a search and replace. |
It looks like the error is issued here: rust/src/librustc_typeck/check/mod.rs Lines 1317 to 1331 in b8ec4c4
That function is invoked from here: rust/src/librustc_typeck/check/mod.rs Lines 1379 to 1384 in b8ec4c4
In that caller's location, we can access the argument to the |
…sion, r=eddyb Self-referencial type now called a recursive type As per Boat's suggestion - rust-lang#62539, this makes the error message clearer.
I presume use a new error number rather than E0720? |
…Centril Explicit error message for async recursion. Attempt at clearer error message when async recusion is attempted. In response to rust-lang#62539 (and rust-lang#53690).
Fixed in #62871. |
Uh oh!
There was an error while loading. Please reload this page.
The following Rust source (playground):
gives the error:
We could be a lot clearer.
The text was updated successfully, but these errors were encountered: