-
Notifications
You must be signed in to change notification settings - Fork 13.3k
JSON errors: give better spans for SpanEnd errors #32714
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
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
Do we have any tests for this stuff? |
@sfackler there is a run-make test for JSON errors, but it is pretty much a smoke test and isn't touched by this patch. To be honest that test has been a real pain, and I'm not keen on making it more painful by adding more coverage, so this PR is untested :-( If we come to rely on JSON errors (I don't believe there are any 'serious' clients at the moment), then we could add tests similar to c-fail, but that feels like a lot of work for now. |
impl DiagnosticSpanLine { | ||
fn from_span(span: &Span, je: &JsonEmitter) -> Vec<DiagnosticSpanLine> { | ||
let lines = match je.cm.span_to_lines(*span) { | ||
macro_rules! get_lines_for_span { |
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.
Why is this a 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.
because of the return - if I make it a function, you still need to match in the caller, so it's not much of a saving.
There's |
@bors r+ |
📌 Commit 8c2a8ae has been approved by |
JSON errors: give better spans for SpanEnd errors
No description provided.