Uh oh!
There was an error while loading. Please reload this page.
Print nicer async/await trait errors for generators in any place in the error 'stack' - #67116
Print nicer async/await trait errors for generators in any place in the error 'stack'#67116Aaron1011 wants to merge 9 commits into
Conversation
rust-highfive
commented
Dec 7, 2019
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
5d60d27 to
54c6927Compare
This comment has been minimized.
This comment has been minimized.
54c6927 to
eff0090Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nikomatsakis
commented
Dec 10, 2019
How does this compare against #65345 ? |
Aaron1011
commented
Dec 10, 2019
@nikomatsakis: #65345 doesn't appear to handle multiple generator in the same error stack, but it has more diagnostic improvements for when it does detect a generator. |
nikomatsakis
commented
Dec 10, 2019
OK. How would you feel about landing #65345 first, and trying to rebase this atop that? |
Aaron1011
commented
Dec 10, 2019
@nikomatsakis: Sounds good to me |
This comment has been minimized.
This comment has been minimized.
1e450a6 to
17d6d11Comparenikomatsakis
commented
Dec 12, 2019
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Mark-Simulacrum
commented
Jan 9, 2020
Hm, maybe we can work around that? (Environment variable or something) It also seems plausibly not bad. Maybe even just giving an issue link without the switching and asking for feedback is good (it's sort of like the survey suggested by Niko, but maybe a bit easier). |
Aaron1011
commented
Jan 11, 2020
Without actually showing the intermediate spans, I'm not sure how useful that would be. If showing that information would end up being distracting and not very useful, this we wouldn't find out by just giving an issue link. Conversely, users might not realize that showing extra spans would be helpful, since they don't know what they would be seeing for their particular error. |
JohnCSimon
commented
Jan 18, 2020
triage: merge conflicts |
@JohnCSimon: This PR is currently blocked on reaching some kind of consensus as to what these kinds of errors should look like:
|
nikomatsakis
commented
Jan 24, 2020
@Aaron1011 do you think you could prepare a hackmd or gist that summarizes the question at hand? It would be great to give some example programs along with two sample outputs, for example. I would like to focus the discussion on very specific examples and proposals. I'd also like to get this resolved. =) |
nikomatsakis
commented
Feb 6, 2020
OK, I prepared a summary of the question at hand -- does this sound like it captures the question |
nikomatsakis
commented
Feb 6, 2020
I was thinking of starting an internals thread to drive this to a conclusion |
nikomatsakis
commented
Feb 6, 2020
Created internals thread here |
nikomatsakis
commented
Feb 13, 2020
We discussed this in our compiler team triage meeting. The internals thread seems to have died down somewhat but the polling at least suggests a preference for "minimal stack trace" (72%). There is definitely some interest in a "verbose mode" as well. But we felt that would best be preferred as a separate consideration. @Aaron1011 do you think you could explore altering the PR to give a more "minimal stack trace"? We'll have to experiment a bit with the best way to format that, I imagine. |
pnkfelix
commented
Mar 4, 2020
Here a link to aforementioned discussion amongst T-compiler. Based on niko's comment above, I am shifting this to S-waiting-on-author instead of team. |
Dylan-DPC-zz
commented
Apr 14, 2020
@Aaron1011 any updates on this? |
nikomatsakis
commented
Apr 28, 2020
I'm going to close this PR, just to keep my list tidy -- @Aaron1011 please feel free to re-open if it's adjusted. Thanks! |
Fixes#67025
Currently, we only print 'nice' async/await trait errors when the 'bad' type inside the generator occurs at the top of the 'stack' of errors (the nested errors in the
ObligationCauseCode.This PR allows these 'nice' error messages to be printed each time we encounter a generator in the error stack. This has the result of showing the user how each
async fncontributed to the overall type not implementing some auto trait.This PR still has a few issues:
GenFuture/impl Future/[static generator]. It would be nice to try to completely eliminate these when it doesn't reduce clarity, as they often add no actual information.issue-64130-non-send-future-diags.rs, forasync fn foo. I suspect that some of the involved lifetimes are causing a false negative when we check if a type occurs within the generator.However, I'd be interested in feedback on the overall idea of displaying multiple spans in the error message.
cc @estebank