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 support for rustc's -Z terminal-width. #8427

Merged
merged 4 commits into from
Jul 9, 2020

Conversation

davidtwco
Copy link
Member

This PR continues the work started in #7315, adding support for rustc's -Z terminal-width flag, which is used to trim diagnostic output to fit within the current terminal and was added in rust-lang/rust#63402 (with JSON emitter support in rust-lang/rust#73763).

At the time of writing, rust-lang/rust#73763 isn't in nightly, so the test added in this PR will fail, but it should pass tomorrow (I've confirmed that it works with a local rustc build).

cc @estebank

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 28, 2020
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks for picking this back up!

Also mentioned here there is some documentation to update.

src/cargo/core/compiler/mod.rs Show resolved Hide resolved
src/cargo/core/shell.rs Outdated Show resolved Hide resolved
src/cargo/core/shell.rs Outdated Show resolved Hide resolved
@davidtwco
Copy link
Member Author

I've also pushed a commit which adds the requested documentation.

@davidtwco davidtwco force-pushed the terminal-width branch 3 times, most recently from c67125c to d1185d0 Compare July 2, 2020 11:19
@bors
Copy link
Collaborator

bors commented Jul 2, 2020

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

@estebank
Copy link
Contributor

estebank commented Jul 4, 2020

I'm not sure if there's an actual use case for manually passing in the width?

I could see third party tools working through cargo instead or rustc directly to use it to make output fit the users viewport, but I guess most tools will be using rustc directly.

@davidtwco davidtwco requested a review from ehuss July 6, 2020 10:53
src/cargo/core/shell.rs Outdated Show resolved Hide resolved
estebank and others added 3 commits July 8, 2020 10:56
This commit adds support for rustc's `-Z terminal-width` flag, which is
used to trim diagnostic output to fit within the current terminal.

Co-authored-by: David Wood <david@davidtw.co>
Signed-off-by: David Wood <david@davidtw.co>
This commit modifies the parsing of `-Z terminal-width` so that it can
optionally take a value and only uses `accurate_err_width` when the user
does not provide a value - therefore making the emission of `-Z
terminal-width` opt-in.

Signed-off-by: David Wood <david@davidtw.co>
This commit adds relevant documentation for the `-Z terminal-width`
flag.

Signed-off-by: David Wood <david@davidtw.co>
src/cargo/core/shell.rs Outdated Show resolved Hide resolved
src/cargo/core/shell.rs Outdated Show resolved Hide resolved
This commit introduces a `TtyWidth` enum which enables better handling
of the tty-width on Windows.

Signed-off-by: David Wood <david@davidtw.co>
@ehuss
Copy link
Contributor

ehuss commented Jul 9, 2020

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Jul 9, 2020

📌 Commit af924d4 has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2020
@bors
Copy link
Collaborator

bors commented Jul 9, 2020

⌛ Testing commit af924d4 with merge 0506d8d...

@bors
Copy link
Collaborator

bors commented Jul 9, 2020

☀️ Test successful - checks-azure
Approved by: ehuss
Pushing 0506d8d to master...

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
Update cargo

4 commits in 4f74d9b2a771c58b7ef4906b2668afd075bc8081..43cf77395cad5b79887b20b7cf19d418bbd703a9
2020-07-08 17:13:00 +0000 to 2020-07-13 17:35:42 +0000
- fix: add space to comments (rust-lang/cargo#8476)
- Allow configuring unstable flags via config file (rust-lang/cargo#8393)
- Add support for rustc's `-Z terminal-width`. (rust-lang/cargo#8427)
- Avoid colliding with older Cargo fingerprint changes (rust-lang/cargo#8473)
@ehuss ehuss added this to the 1.47.0 milestone Feb 6, 2022
@davidtwco davidtwco deleted the terminal-width branch April 3, 2022 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants