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

Strip code to the left and right in diagnostics for long lines #63402

Open
wants to merge 7 commits into
base: master
from

Conversation

@estebank
Copy link
Contributor

commented Aug 9, 2019

Fix #62999.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Aug 9, 2019

r? @eddyb

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

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Aug 9, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-08-09T06:19:28.1718588Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-09T06:19:28.1923432Z ##[command]git config gc.auto 0
2019-08-09T06:19:28.1992606Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-09T06:19:28.2053340Z ##[command]git config --get-all http.proxy
2019-08-09T06:19:28.2211548Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/63402/merge:refs/remotes/pull/63402/merge
---
2019-08-09T06:20:03.5115857Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-09T06:20:03.5115913Z 
2019-08-09T06:20:03.5116178Z   git checkout -b <new-branch-name>
2019-08-09T06:20:03.5116214Z 
2019-08-09T06:20:03.5116280Z HEAD is now at 9ac753be9 Merge 5873a187f559f18eb84dfe6dc06119b0ab9bff77 into 5aa3d9a7b5d3a46a7f158e8881146331a6bc9243
2019-08-09T06:20:03.5276613Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-09T06:20:03.5279885Z ==============================================================================
2019-08-09T06:20:03.5279992Z Task         : Bash
2019-08-09T06:20:03.5280045Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-09T06:26:18.2232007Z    Compiling serde_json v1.0.40
2019-08-09T06:26:22.7806528Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-08-09T06:26:31.9661996Z     Finished release [optimized] target(s) in 1m 41s
2019-08-09T06:26:31.9735066Z tidy check
2019-08-09T06:26:32.4693273Z tidy error: /checkout/src/librustc_errors/emitter.rs:260: line longer than 100 chars
2019-08-09T06:26:33.9864636Z Stray file with UI testing output: "/checkout/src/test/ui/feature-gates/feature-gate-existential-type.stderr"
2019-08-09T06:26:33.9897010Z Stray file with UI testing output: "/checkout/src/test/ui/feature-gate/await-macro.stderr"
2019-08-09T06:26:34.0167286Z Stray file with UI testing output: "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr"
2019-08-09T06:26:34.0169306Z Stray file with UI testing output: "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr"
2019-08-09T06:26:34.0170032Z Stray file with UI testing output: "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr"
2019-08-09T06:26:34.0174872Z Stray file with UI testing output: "/checkout/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr"
2019-08-09T06:26:34.0218175Z Stray file with UI testing output: "/checkout/src/test/ui/issues/issue-26158.stderr"
2019-08-09T06:26:34.0270542Z Stray file with UI testing output: "/checkout/src/test/ui/allocator-submodule.stderr"
2019-08-09T06:26:34.0283340Z some tidy checks failed
2019-08-09T06:26:34.0290351Z 
2019-08-09T06:26:34.0290351Z 
2019-08-09T06:26:34.0291616Z 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"
2019-08-09T06:26:34.0291803Z 
2019-08-09T06:26:34.0291828Z 
2019-08-09T06:26:34.0294396Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-08-09T06:26:34.0294461Z Build completed unsuccessfully in 0:01:44
2019-08-09T06:26:34.0294461Z Build completed unsuccessfully in 0:01:44
2019-08-09T06:26:35.7435023Z ##[error]Bash exited with code '1'.
2019-08-09T06:26:35.7465993Z ##[section]Starting: Checkout
2019-08-09T06:26:35.7467639Z ==============================================================================
2019-08-09T06:26:35.7467696Z Task         : Get sources
2019-08-09T06:26:35.7467761Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Aug 9, 2019

TODO:

  • Rebase
  • Fix tests
  • Handle Unicode slicing correctly
  • Use calculated margins to aim at the span being roughly centered, but bias towards stripping more whitespace than code
  • Add width rustc flag so that cargo can set the current column width (running cargo will default the output to 140 chars)
  • Consider centering the position of the span as much as possible.

Current look on the code in the original report:

Screen Shot 2019-08-08 at 11 17 09 PM


Edit: current look
Screen Shot 2019-08-14 at 11 36 15 AM


Edit:

Screen Shot 2019-08-14 at 2 21 57 PM

@estebank estebank changed the title [WIP] Strip code to the left and right in diagnostics for long lines Strip code to the left and right in diagnostics for long lines Aug 14, 2019

@estebank estebank force-pushed the estebank:strip-margin branch from 5873a18 to f240167 Aug 14, 2019

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Aug 14, 2019

@rust-lang/wg-diagnostics @Centril @nikomatsakis you all might be interested in taking a look at this.

What it looks like in practice:

Screen Shot 2019-08-14 at 11 39 50 AM


Update: now centered:

Screen Shot 2019-08-14 at 2 06 37 PM

@Centril

This comment has been minimized.

Copy link
Member

commented Aug 14, 2019

@estebank how does it look right now?

@estebank

This comment has been minimized.

Copy link
Contributor Author

commented Aug 14, 2019

how does it look right now?

@Centril I'm not sure I follow? I have screenshots in the comments.

Right now the logic is:

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Aug 14, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-08-14T18:46:38.8915932Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-14T18:46:38.9088465Z ##[command]git config gc.auto 0
2019-08-14T18:46:38.9168523Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-14T18:46:38.9223348Z ##[command]git config --get-all http.proxy
2019-08-14T18:46:38.9361009Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/63402/merge:refs/remotes/pull/63402/merge
---
2019-08-14T18:47:13.8191975Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-14T18:47:13.8192017Z 
2019-08-14T18:47:13.8192198Z   git checkout -b <new-branch-name>
2019-08-14T18:47:13.8192223Z 
2019-08-14T18:47:13.8192279Z HEAD is now at 763d00b0e Merge 53546269a437ccbad26998a1aa65f25f3c82eeec into c43d03a19f326f4a323569328cc501e86eb6d22e
2019-08-14T18:47:13.8338886Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-14T18:47:13.8341425Z ==============================================================================
2019-08-14T18:47:13.8341471Z Task         : Bash
2019-08-14T18:47:13.8341508Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-14T18:53:24.9357813Z    Compiling serde_json v1.0.40
2019-08-14T18:53:29.1395700Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-08-14T18:53:37.5472219Z     Finished release [optimized] target(s) in 1m 27s
2019-08-14T18:53:37.5544276Z tidy check
2019-08-14T18:53:37.9728312Z tidy error: /checkout/src/librustc_errors/emitter.rs:1262: TODO is deprecated; use FIXME
2019-08-14T18:53:39.3798763Z some tidy checks failed
2019-08-14T18:53:39.3805735Z 
2019-08-14T18:53:39.3805735Z 
2019-08-14T18:53:39.3807575Z 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"
2019-08-14T18:53:39.3808190Z 
2019-08-14T18:53:39.3808280Z 
2019-08-14T18:53:39.3809400Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-08-14T18:53:39.3809628Z Build completed unsuccessfully in 0:01:30
2019-08-14T18:53:39.3809628Z Build completed unsuccessfully in 0:01:30
2019-08-14T18:53:39.3852232Z == clock drift check ==
2019-08-14T18:53:39.3863337Z   local time: Wed Aug 14 18:53:39 UTC 2019
2019-08-14T18:53:39.4708365Z   network time: Wed, 14 Aug 2019 18:53:39 GMT
2019-08-14T18:53:39.4710878Z == end clock drift check ==
2019-08-14T18:53:40.8283656Z ##[error]Bash exited with code '1'.
2019-08-14T18:53:40.8312378Z ##[section]Starting: Checkout
2019-08-14T18:53:40.8314105Z ==============================================================================
2019-08-14T18:53:40.8314164Z Task         : Get sources
2019-08-14T18:53:40.8314313Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Centril

This comment has been minimized.

Copy link
Member

commented Aug 14, 2019

@estebank sounds good :)

@estebank estebank force-pushed the estebank:strip-margin branch from 5354626 to 440b3f7 Aug 14, 2019

@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2019

Idk how I feel about this. It will make the move to annotate_snippets harder

@eddyb

This comment has been minimized.

Copy link
Member

commented Aug 15, 2019

@oli-obk Can we add this to annotate_snippets instead, and try to speed up the move?

@bors

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2019

☔️ The latest upstream changes (presumably #63627) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.