Skip to content

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

Merged
merged 1 commit into from
Apr 5, 2016

Conversation

nrc
Copy link
Member

@nrc nrc commented Apr 3, 2016

No description provided.

@rust-highfive
Copy link
Contributor

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@sfackler
Copy link
Member

sfackler commented Apr 3, 2016

Do we have any tests for this stuff?

@nrc
Copy link
Member Author

nrc commented Apr 3, 2016

@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 {
Copy link
Member

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?

Copy link
Member Author

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.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 4, 2016

I don't believe there are any 'serious' clients at the moment

There's https://clippy.bashy.io/ (but that just uses it to count the number of errors)

@sfackler
Copy link
Member

sfackler commented Apr 5, 2016

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 5, 2016

📌 Commit 8c2a8ae has been approved by sfackler

Manishearth added a commit to Manishearth/rust that referenced this pull request Apr 5, 2016
JSON errors: give better spans for SpanEnd errors
bors added a commit that referenced this pull request Apr 5, 2016
Rollup of 11 pull requests

- Successful merges: #32403, #32596, #32675, #32678, #32685, #32686, #32692, #32710, #32712, #32714, #32715
- Failed merges: #32488
@bors bors merged commit 8c2a8ae into rust-lang:master Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants