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

Conversation

Projects
None yet
9 participants
@nrc
Copy link
Member

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

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 5, 2016

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"),

This comment has been minimized.

@huonw

huonw Jan 5, 2016

Member

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

This comment has been minimized.

Copy link
Member

huonw commented Jan 5, 2016

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

@nrc

This comment has been minimized.

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

This comment has been minimized.

@huonw

huonw Jan 7, 2016

Member

Maybe there could be an example with suberrors too?

@@ -14,7 +14,6 @@
pub use self::EntryFnType::*;
pub use self::CrateType::*;
pub use self::Passes::*;
pub use self::OptLevel::*;

This comment has been minimized.

@huonw

huonw Jan 7, 2016

Member

Should this [breaking-change] be mentioned in the commit message?

@@ -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("", "err-format", "How errors and other messages are produced", "human|json"),

This comment has been minimized.

@huonw

huonw Jan 7, 2016

Member

The abbreviation of err instead of just using error doesn't seem worth it to me; thoughts?

This comment has been minimized.

@nrc

nrc Jan 7, 2016

Author Member

Hmm, I started with error-format, and it just looked really long for an option. I agree err-format is not much better though

@nrc nrc force-pushed the nrc:json-errs branch from bb7e80b to 4be8667 Jan 11, 2016

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented Jan 11, 2016

@huonw comments addessed

@huonw

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 11, 2016

📌 Commit 4be8667 has been approved by huonw

bors added a commit that referenced this pull request Jan 11, 2016

Auto merge of #30711 - nrc:json-errs, r=huonw
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 11, 2016

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 11, 2016

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

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented Jan 11, 2016

@bors retry

bors added a commit that referenced this pull request Jan 11, 2016

Auto merge of #30711 - nrc:json-errs, r=huonw
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 11, 2016

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 11, 2016

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

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 11, 2016

@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

This comment has been minimized.

Copy link
Contributor

ticki commented Jan 11, 2016

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 12, 2016

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

bors added a commit that referenced this pull request Jan 12, 2016

Auto merge of #30711 - nrc:json-errs, r=huonw
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

This comment has been minimized.

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

This comment has been minimized.

@nagisa

nagisa Jan 12, 2016

Contributor

Why?

This comment has been minimized.

@nrc

nrc Jan 12, 2016

Author Member

whoops left over from an earlier version

nrc added some commits Dec 31, 2015

Implement JSON error emission
[breaking-change]

syntax::errors::Handler::new has been renamed to with_tty_emitter

Many functions which used to take a syntax::errors::ColorConfig, now take a rustc::session::config::ErrorOutputType. If you previously used ColorConfig::Auto as a default, you should now use ErrorOutputType::default().
Add a test
And fix bustage in make check

@nrc nrc force-pushed the nrc:json-errs branch from ddbeb1f to 68653e1 Jan 14, 2016

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented Jan 14, 2016

@bors: r=huonw

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 14, 2016

📌 Commit 68653e1 has been approved by huonw

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 15, 2016

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

bors added a commit that referenced this pull request Jan 15, 2016

Auto merge of #30711 - nrc:json-errs, r=huonw
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 15, 2016

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

Address reviewer comments
[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 nrc force-pushed the nrc:json-errs branch from 68653e1 to 82f8e5c Jan 15, 2016

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented Jan 15, 2016

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 15, 2016

📌 Commit 82f8e5c has been approved by nrc

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented Jan 15, 2016

@bors: r=huonw

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 15, 2016

📌 Commit 82f8e5c has been approved by huonw

@bors

This comment has been minimized.

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

Auto merge of #30711 - nrc:json-errs, r=huonw
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 15, 2016

💔 Test failed - auto-mac-32-opt

@nrc

This comment has been minimized.

Copy link
Member Author

nrc commented Jan 15, 2016

@bors retry

@nagisa

This comment has been minimized.

Copy link
Contributor

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

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@nrc nrc added the relnotes label Jan 19, 2016

@bruno-medeiros

This comment has been minimized.

Copy link

bruno-medeiros commented Mar 10, 2016

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
You can’t perform that action at this time.