Skip to content
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

Emit JSON errors #30711

Merged
merged 5 commits into from
Jan 15, 2016
Merged

Emit JSON errors #30711

merged 5 commits into from
Jan 15, 2016

Conversation

nrc
Copy link
Member

@nrc nrc commented Jan 5, 2016

The compiler can emit errors and warning in JSON format. This is a more easily machine readable form then the usual error output.

Closes #10492, closes #14863.

@rust-highfive
Copy link
Collaborator

r? @sfackler

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

@@ -855,6 +866,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
"NAME=PATH"),
opt::opt("", "sysroot", "Override the system root", "PATH"),
opt::multi("Z", "", "Set internal debugging options", "FLAG"),
opt::opt_u("", "output", "How errors and other mesasges are produced", "tty|json"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we should have --output as the long form of -o, so maybe this could be --error-format or something? Also, the "tty" format might be better as "human", since e.g. json can go to a tty and the human-readable version can go to a file.

("Mesasges" is spelt wrong.)

@huonw
Copy link
Member

huonw commented Jan 5, 2016

This can probably close #10492 (edit: and #14863).

@nrc
Copy link
Member Author

nrc commented Jan 6, 2016

r? @huonw (comment addressed)

@rust-highfive rust-highfive assigned huonw and unassigned sfackler Jan 6, 2016
cp foo.rs $(TMPDIR)
cd $(TMPDIR)
$(RUSTC) -Z unstable-options --output=json foo.rs 2>foo.log || true
grep -q '{"message":"unresolved name `y`","code":{"code":"E0425","explanation":"\\nAn unresolved name was used. Example of erroneous codes.*"},"level":"error","span":{"file_name":"foo.rs","byte_start":523,"byte_end":524,"line_start":14,"line_end":14,"column_start":18,"column_end":19},"children":\[\]}' foo.log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there could be an example with suberrors too?

@nrc
Copy link
Member Author

nrc commented Jan 11, 2016

@huonw comments addessed

@huonw
Copy link
Member

huonw commented Jan 11, 2016

@bors r+

I'm someone concerned about defacto stabilisation of the format, but it is under -Z unstable-options so it probably won't be a problem...

@bors
Copy link
Contributor

bors commented Jan 11, 2016

📌 Commit 4be8667 has been approved by huonw

@bors
Copy link
Contributor

bors commented Jan 11, 2016

⌛ Testing commit 4be8667 with merge 0af09ca...

@bors
Copy link
Contributor

bors commented Jan 11, 2016

💔 Test failed - auto-win-msvc-64-opt

@nrc
Copy link
Member Author

nrc commented Jan 11, 2016

@bors retry

@bors
Copy link
Contributor

bors commented Jan 11, 2016

⌛ Testing commit 4be8667 with merge 14bc8e5...

@bors
Copy link
Contributor

bors commented Jan 11, 2016

💔 Test failed - auto-mac-64-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Jan 11, 2016 at 4:40 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-mac-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/7658


Reply to this email directly or view it on GitHub
#30711 (comment).

@ticki
Copy link
Contributor

ticki commented Jan 11, 2016

I'm not sure why bors failing. It compiles fine.

@bors
Copy link
Contributor

bors commented Jan 12, 2016

⌛ Testing commit 4be8667 with merge 2f2615f...

@bors
Copy link
Contributor

bors commented Jan 12, 2016

💔 Test failed - auto-mac-64-nopt-t

// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-tidy-linelength
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops left over from an earlier version

And fix bustage in make check
@nrc
Copy link
Member Author

nrc commented Jan 14, 2016

@bors: r=huonw

@bors
Copy link
Contributor

bors commented Jan 14, 2016

📌 Commit 68653e1 has been approved by huonw

@bors
Copy link
Contributor

bors commented Jan 15, 2016

⌛ Testing commit 68653e1 with merge 96511fe...

@bors
Copy link
Contributor

bors commented Jan 15, 2016

💔 Test failed - auto-mac-64-nopt-t

[breaking-change]

`OptLevel` variants are no longer `pub use`ed by rust::session::config. If you are using these variants, you must change your code to prefix the variant name with `OptLevel`.
@nrc
Copy link
Member Author

nrc commented Jan 15, 2016

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 15, 2016

📌 Commit 82f8e5c has been approved by nrc

@nrc
Copy link
Member Author

nrc commented Jan 15, 2016

@bors: r=huonw

@bors
Copy link
Contributor

bors commented Jan 15, 2016

📌 Commit 82f8e5c has been approved by huonw

@bors
Copy link
Contributor

bors commented Jan 15, 2016

⌛ Testing commit 82f8e5c with merge d8869d3...

bors added a commit that referenced this pull request Jan 15, 2016
The compiler can emit errors and warning in JSON format. This is a more easily machine readable form then the usual error output.

Closes #10492, closes #14863.
@bors
Copy link
Contributor

bors commented Jan 15, 2016

💔 Test failed - auto-mac-32-opt

@nrc
Copy link
Member Author

nrc commented Jan 15, 2016

@bors retry

@nagisa
Copy link
Member

nagisa commented Jan 15, 2016

Feel free to retry force this because its not landing gonna be causing
spurious errors for all other PRs.
On Jan 15, 2016 6:47 AM, "bors" notifications@github.com wrote:

[image: ⚡] Previous build results for auto-linux-cross-opt
http://buildbot.rust-lang.org/builders/auto-linux-cross-opt/builds/871,
auto-mac-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/7712,
auto-mac-64-opt
http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/7676,
auto-win-msvc-32-opt
http://buildbot.rust-lang.org/builders/auto-win-msvc-32-opt/builds/1930
are reusable. Rebuilding only auto-linux-32-nopt-t
http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/7691,
auto-linux-32-opt
http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/7712,
auto-linux-64-debug-opt
http://buildbot.rust-lang.org/builders/auto-linux-64-debug-opt/builds/962,
auto-linux-64-nopt-t
http://buildbot.rust-lang.org/b%20uilders/auto-linux-64-nopt-t/builds/7649,
auto-linux-64-opt
http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/7666,
auto-linux-64-x-android-t
http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/7651,
auto-linux-musl-64-opt
http://buildbot.rust-lang.org/builders/auto-linux-musl-64-opt/builds/2821,
auto-mac-32-opt
http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/7715,
auto-win-gnu-32-nopt-t
http://buildbot.rust-lang.org/builders/auto-win-gnu-32-nopt-t/builds/2694,
auto-win-gnu-32-opt
http://buildbot.rust-lang.org/builders/auto-win-gnu-32-opt/builds/2709,
auto-win-gnu-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-win-gnu-64-nopt-t/builds/2709,
auto-win-gnu-64-opt
http://buildbot.rust-lang.org/builders/auto-win-gnu-64-opt/builds/2687,
auto-win-msvc-64-opt
http://buildbot.rust-lang.org/builders/auto-win-msvc-6%204-opt/builds/2691
...


Reply to this email directly or view it on GitHub
#30711 (comment).

@bors bors merged commit 82f8e5c into rust-lang:master Jan 15, 2016
@nrc nrc added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 19, 2016
@bruno-medeiros
Copy link

Interesting, definitely a welcome addition for the IDE world.

However, I've only found out about this by chance, from seeing #30701 on Rust Weekly. Could we aggregate all changes related to IDE development in some communication channel/method? I was about to suggest an Issues label, however there doesn't seem to be a way to follow one, plus there might be changes spanning from more than one Git project (Cargo and rust for example), so it wouldn't work well to put under one label.

Perhaps we could post about these changes on a tracker issue, like #31548 or a similar one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Machine readable rustc output Redesign compiler diagnostic logging
9 participants