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

Add new diagnostic writer using annotate-snippet library #61407

Merged
merged 5 commits into from Jun 4, 2019

Conversation

Projects
None yet
7 participants
@phansch
Copy link
Contributor

commented May 31, 2019

This adds a new diagnostic writer AnnotateRsEmitterWriter that uses
the annotate-snippet library to print out the human readable
diagnostics.

The goal of #59346 is to eventually switch over to using the library instead of
maintaining our own diagnostics output.

This PR does not add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can start contributing as well.

There are some FIXMEs in librustc_errors/annotate_rs_emitter.rs that
point at yet to be implemented features of the new diagnostic emitter, however
those are most likely not exhaustive.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2019

r? @oli-obk

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

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0fc08264:start=1559331014409966932,finish=1559331166350466336,duration=151940499404
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---

[00:04:21] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:9: line longer than 100 chars
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:72: TODO is deprecated; use FIXME
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:75: line longer than 100 chars
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:92: TODO is deprecated; use FIXME
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:97: line longer than 100 chars
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:108: line longer than 100 chars
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:115: line longer than 100 chars
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs:140: TODO is deprecated; use FIXME
[00:04:21] tidy error: /checkout/src/librustc_errors/annotate_rs_emitter.rs: too many trailing newlines (2)
[00:04:21] tidy error: /checkout/src/librustc/session/config.rs:1979: line longer than 100 chars
[00:04:21] tidy error: /checkout/src/librustc/session/config.rs:2016: line longer than 100 chars
[00:04:26] Dependencies not on the whitelist:
[00:04:26] * annotate-snippets 
[00:04:26] * ansi_term 
[00:04:26] some tidy checks failed
[00:04:26] 
[00:04:26] 
[00:04:26] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:26] 
[00:04:26] 
[00:04:26] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:26] Build completed unsuccessfully in 0:01:16
---
travis_time:end:0063792c:start=1559331442935453438,finish=1559331442941238311,duration=5784873
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0a16972f
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0c3781c4
travis_time:start:0c3781c4
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:134dc9c1
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@phansch phansch force-pushed the phansch:annotate_snippet_refactoring1 branch from 5308a62 to 3090541 May 31, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:05332188:start=1559333303814721910,finish=1559333306301868588,duration=2487146678
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
travis_time:start:test_ui
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:57:00] 
[00:57:00] running 5609 tests
[00:57:03] .........F.......................................................................................... 100/5609
[00:57:13] .................................................................................................... 300/5609
[00:57:17] .................................................................................................... 400/5609
[00:57:20] .................................................................................................... 500/5609
[00:57:24] i................................................................................................... 600/5609
---
[01:00:42]   |
[01:00:42] 
[01:00:42] 
[01:00:42] The actual stdout differed from the expected stdout.
[01:00:42] Actual stdout saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/annotate-snippet/missing-type/missing-type.stdout
[01:00:42] To update references, rerun the tests and pass the `--bless` flag
[01:00:42] To only update this specific test, also pass `--test-args annotate-snippet/missing-type.rs`
[01:00:42] error: 1 errors occurred comparing output.
[01:00:42] status: exit code: 1
[01:00:42] status: exit code: 1
[01:00:42] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/annotate-snippet/missing-type.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/annotate-snippet/missing-type" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--error-format" "human-annotate-rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/annotate-snippet/missing-type/auxiliary" "-A" "unused"
[01:00:42] ------------------------------------------
[01:00:42] error[E0412]: cannot find type `Iter` in this scope
[01:00:42]  --> /checkout/src/test/ui/annotate-snippet/missing-type.rs:4:11
[01:00:42]   |
---
[01:00:42] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:521:22
[01:00:42] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:00:42] 
[01:00:42] 
[01:00:42] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:00:42] 
[01:00:42] 
[01:00:42] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:42] Build completed unsuccessfully in 0:56:01
---
travis_time:end:150e1d06:start=1559336961463716439,finish=1559336961469035418,duration=5318979
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:05ef3cac
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@oli-obk
Copy link
Contributor

left a comment

awesome, just some nits and maybe opinions on the ansi_term transitive dependency.

Show resolved Hide resolved src/librustc_errors/annotate_rs_emitter.rs Outdated
Show resolved Hide resolved src/librustc_errors/annotate_rs_emitter.rs Outdated
Show resolved Hide resolved src/librustc_errors/annotate_rs_emitter.rs Outdated
Show resolved Hide resolved src/librustc_errors/annotate_rs_emitter.rs Outdated
@@ -62,6 +62,8 @@ const WHITELIST_CRATES: &[CrateVersion<'_>] = &[
const WHITELIST: &[Crate<'_>] = &[
Crate("adler32"),
Crate("aho-corasick"),
Crate("annotate-snippets"),
Crate("ansi_term"),

This comment has been minimized.

Copy link
@oli-obk

oli-obk Jun 2, 2019

Contributor

cc @rust-lang/compiler we're pulling in a new dependency here, and we have no control over it: ansi_term (annotate-snippets is also a new dep, but it is under the rust-lang org: https://github.com/rust-lang/annotate-snippets-rs).

This comment has been minimized.

Copy link
@nagisa

nagisa Jun 2, 2019

Contributor

Two points in favour of allowing it: its license (MIT) is in our list of allowed licenses for external crates; and it is already a transitive dependency of our other core projects such as cargo.

As long as changes to the ansi_term are vetted as part of the annotate-snippets crate and the crate is locked to a specific patch version I’m in favour of the dependency.

This comment has been minimized.

Copy link
@phansch

phansch Jun 3, 2019

Author Contributor

The usage of ansi_term in annotate-snippets seems pretty lightweight so far and we could probably switch to another one as well, if that's a concern.

@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

@bors r+ let's get this show on the road, we can always refactor if anything strong would speak against ansi_term

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

📌 Commit 3ab812e has been approved by oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout annotate_snippet_refactoring1 (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self annotate_snippet_refactoring1 --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
warning: Cannot merge binary files: Cargo.lock (HEAD vs. heads/homu-tmp)
Auto-merging src/tools/tidy/src/deps.rs
Auto-merging src/librustc/session/config.rs
Auto-merging Cargo.lock
CONFLICT (content): Merge conflict in Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

phansch added some commits May 31, 2019

Add new diagnostic writer using annotate-snippet library
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.

The goal is to eventually switch over to using the library instead of
maintaining our own diagnostics output.

This commit does *not* add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can contribute as well.

[as]: https://github.com/rust-lang/annotate-snippets-rs

@phansch phansch force-pushed the phansch:annotate_snippet_refactoring1 branch from 3ab812e to bfe5d97 Jun 4, 2019

@phansch

This comment has been minimized.

Copy link
Contributor Author

commented Jun 4, 2019

Rebased.

@cramertj

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

📌 Commit bfe5d97 has been approved by oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

⌛️ Testing commit bfe5d97 with merge 5d8f59f...

bors added a commit that referenced this pull request Jun 4, 2019

Auto merge of #61407 - phansch:annotate_snippet_refactoring1, r=oli-obk
Add new diagnostic writer using annotate-snippet library

This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.

The goal of #59346 is to eventually switch over to using the library instead of
maintaining our own diagnostics output.

This PR does **not** add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can start contributing as well.

There are some FIXMEs in `librustc_errors/annotate_rs_emitter.rs` that
point at yet to be implemented features of the new diagnostic emitter, however
those are most likely not exhaustive.

[as]: https://github.com/rust-lang/annotate-snippets-rs
@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 5d8f59f to master...

@bors bors added the merged-by-bors label Jun 4, 2019

@bors bors merged commit bfe5d97 into rust-lang:master Jun 4, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 4, 2019

📣 Toolstate changed by #61407!

Tested on commit 5d8f59f.
Direct link to PR: #61407

💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jun 4, 2019

📣 Toolstate changed by rust-lang/rust#61407!
Tested on commit rust-lang/rust@5d8f59f.
Direct link to PR: <rust-lang/rust#61407>

💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
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.