-
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
Emit JSON errors #30711
Emit JSON errors #30711
Conversation
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"), |
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.
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.)
r? @huonw (comment addressed) |
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 |
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.
Maybe there could be an example with suberrors too?
@huonw comments addessed |
@bors r+ I'm someone concerned about defacto stabilisation of the format, but it is under |
📌 Commit 4be8667 has been approved by |
⌛ Testing commit 4be8667 with merge 0af09ca... |
💔 Test failed - auto-win-msvc-64-opt |
@bors retry |
⌛ Testing commit 4be8667 with merge 14bc8e5... |
💔 Test failed - auto-mac-64-nopt-t |
@bors: retry On Mon, Jan 11, 2016 at 4:40 PM, bors notifications@github.com wrote:
|
I'm not sure why bors failing. It compiles fine. |
⌛ Testing commit 4be8667 with merge 2f2615f... |
💔 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 |
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?
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.
whoops left over from an earlier version
And fix bustage in make check
@bors: r=huonw |
📌 Commit 68653e1 has been approved by |
⌛ Testing commit 68653e1 with merge 96511fe... |
💔 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`.
@bors: r+ |
📌 Commit 82f8e5c has been approved by |
@bors: r=huonw |
📌 Commit 82f8e5c has been approved by |
💔 Test failed - auto-mac-32-opt |
@bors retry |
⚡ Previous build results for auto-linux-cross-opt, auto-mac-64-nopt-t, auto-mac-64-opt, auto-win-msvc-32-opt are reusable. Rebuilding only auto-linux-32-nopt-t, auto-linux-32-opt, auto-linux-64-debug-opt, auto-linux-64-nopt-t, auto-linux-64-opt, auto-linux-64-x-android-t, auto-linux-musl-64-opt, auto-mac-32-opt, auto-win-gnu-32-nopt-t, auto-win-gnu-32-opt, auto-win-gnu-64-nopt-t, auto-win-gnu-64-opt, auto-win-msvc-64-opt... |
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? |
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.