-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
JSON errors with suggestions are incomplete #30701
Comments
@nrc mind if I run with this one? Additionally, if I have any questions is it okay to ping you? |
@AnthonyBroadCrawford that would be great and please feel free to ping me. Note that JSON errors haven't landed yet, you'll need this to land first: #30711 (or you could pull that branch and work off that). |
@AnthonyBroadCrawford I wish I knew! As soon as it gets a review and passes tests :-). Hopefully, by the start of next week. |
@nrc Awesome. For now I'll just merge that branch into my fork/branch to work from there. I can rebase if any changes come about via the review. Thanks again! |
@AnthonyBroadCrawford #30711 has finally landed, sorry that took so long. Did you manage to get started? Do you need any pointers? |
Not yet. I'll be on it tonight. Looking forward to digging into @nrc. Are you in the IRC channel usually? If so, I'll message you there. |
Also, I'll take any pointers or advice you have. This would be my first commit to this project and I'm just starting to get the lay of the land reading the code-base et al. |
@AnthonyBroadCrawford yes, I tend to be in #rust-internals and #rustc during working hours in NZ. I'll also see mentions if you ping me when I'm not online. This is where you should start: https://dxr.mozilla.org/rust/source/src/libsyntax/errors/json.rs#187 This is how it is done for the normal error emitter: https://dxr.mozilla.org/rust/source/src/libsyntax/errors/emitter.rs#221-265. In particular, you probably want something like complete as the text for the JSON. The way JSON errors work is we make a bunch of structs and then serialise them to JSON. The struct which represents a span is DiagnosticSpan. At the moment, we don't include the actual code in there, just enough detail to find the code in the source text. With suggestions, we want to suggest some code to replace that span. So we should add a field for that ( |
@nrc Thanks, this is helpful. What's the best way to produce the errors as json. Are those details available in the previous pr that this issue depends on? (I'm going to go look there and if I find what I'm looking for I'll update this thread) |
run rustc with the flags |
Keeping you in the loop @nrc as I should have a PR for you to pee at tomorrow. |
@AnthonyBroadCrawford @nrc Note that the layout of |
thanks @mitaa |
Is anyone working at this? I could take a shot. |
ping @AnthonyBroadCrawford re the above comment. Are you still looking at this? |
This was fixed as part of porting compiletest to JSON in #33020, and FIXME is no more. |
The suggestion code snippet does not include the suggested change, it has the original code.
To fix this, look for the FIXME for this issue in src/libsyntax/errors/json.rs. We should extend
DiagnosticSpan
with another field:override_snippet
and use this in the suggestion case.The text was updated successfully, but these errors were encountered: