-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
driver: Use atty
instead of rolling our own
#80897
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
r? @jyn514 maybe? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Forgot to update |
@@ -546,24 +546,12 @@ impl Compilation { | |||
#[derive(Copy, Clone)] | |||
pub struct RustcDefaultCalls; | |||
|
|||
// FIXME remove these and use winapi 0.3 instead | |||
// Duplicates: bootstrap/compile.rs, librustc_errors/emitter.rs |
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.
Can you also use atty
in bootstrap and librustc_errors?
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 couldn't find the duplicates it's referring to. rustc_errors
seems to use atty
already, and I don't see anything in bootstrap
. If you know of a spot that has a duplicate, I'm happy to update it!
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 found library/test/src/helpers/isatty.rs
, but it might be tricky to convert that one since it's part of the runtime. This seems fine for now.
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.
Based on a Git blame, these functions were added way back in #42732. Initially that PR added the dependency isatty
, but Mark-Simulacrum requested that it be removed in #42732 (comment) since it depended on something with long build times.
Thanks for reminding me! |
Rationale: - `atty` is widely used in the Rust ecosystem - We already use it (in `rustc_errors` and other places) - We shouldn't be rolling our own TTY detector when there's a widely-used, well-tested package that we can use
Rebased. |
@bors r+ |
📌 Commit 8c43160 has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#79757 (Replace tabs earlier in diagnostics) - rust-lang#80600 (Add `MaybeUninit` method `array_assume_init`) - rust-lang#80880 (Move some tests to more reasonable directories) - rust-lang#80897 (driver: Use `atty` instead of rolling our own) - rust-lang#80898 (Add another test case for rust-lang#79808) - rust-lang#80917 (core/slice: remove doc comment about scoped borrow) - rust-lang#80927 (Replace a simple `if let` with the `matches` macro) - rust-lang#80930 (fix typo in trait method mutability mismatch help) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #80888.
Rationale:
atty
is widely used in the Rust ecosystemrustc_errors
and other places)widely-used, well-tested package that we can use