-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: Only output ANSI logging if connected to a terminal #78548
Conversation
r? @lcnr (rust_highfive has picked a reviewer for you, use r? to override) |
This is the change in the contents of Note: I only showed the first 30 or so lines for brevity. Before
After
|
Hmm, it looks like log colors aren't working when connected to a terminal... EDIT: Never mind, it's working correctly. Not sure what happened before 🤷 |
Would it be possible to add an option to always enable color logging? I like to view logs with |
I've never added a driver CLI option before, so I would appreciate it if you could give me general instructions on how to do it! I looked at the "Command-line arguments" chapter in the rustc-dev-guide, but it doesn't seem to give instructions on how to add an option. |
Stable options go in rust/compiler/rustc_session/src/config.rs Line 958 in d683e3a
rust/compiler/rustc_session/src/options.rs Line 821 in d683e3a
|
@jyn514 Okay, I finally got the new driver option working. Unfortunately, I think all the other tools that use the driver (rustdoc, miri, etc.) will have to be updated :/ Or do rustc options get passed through to rustdoc and the rest, and I can just access the option there? Not sure how to proceed. |
@camelid I know rustc options get passed through to rustdoc. Not sure about other tools, maybe hard-code them for now? Or ask in T-clippy on zulip. |
Hm, I wonder why the cranelift error was not caught when I ran |
you need to enable cranelift by adding it to your Lines 479 to 482 in 0d33ab7
|
❤️ don't have the capacity to review this myself rn r? @oli-obk |
The log color variable is whatever the log variable is (`RUSTC_LOG`, `RUSTDOC_LOG`, `MIRI_LOG`, etc.) + `_COLOR`. So `RUSTC_LOG_COLOR`, `RUSTDOC_LOG_COLOR`, `MIRI_LOG_COLOR`, etc. Thanks to @RalfJung for suggesting this! It was much easier to implement than adding a new unstable argument, which is what I tried before.
compiler/rustc_driver/src/lib.rs
Outdated
}, | ||
Err(std::env::VarError::NotPresent) => stdout_isatty(), | ||
Err(std::env::VarError::NotUnicode(_value)) => { | ||
panic!("non-unicode log color value: expected one of always, never, or auto") |
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.
This should use early_error
I think.
Marking as draft since there are a few kinks to work out. |
⌛ Testing commit 173a7db with merge 0c05693eb54fd636c3b429610b558246685af361... |
💔 Test failed - checks-actions |
Seems spurious? Not sure what's going wrong.
@bors retry |
⌛ Testing commit 173a7db with merge 6cd99ee574cfcda812ce847b25134a49371f2bf1... |
💔 Test failed - checks-actions |
2nd time we got that same strange error?
@pietroalbini @Mark-Simulacrum any idea what might be happening? |
Is this happening only on this PR? That partition has 52GB of free disk space... |
@pietroalbini is there a way to see where the disk usage is coming from on the CI builder? |
Looks like the Windows builder succeeded this time! Still waiting on aarch64-apple though. |
☀️ Test successful - checks-actions |
…crum Make `x.py --color always` apply to logging too Follow-up to rust-lang#78548, rust-lang#79004. r? `@Mark-Simulacrum`
…crum Make `x.py --color always` apply to logging too Follow-up to rust-lang#78548, rust-lang#79004. r? ``@Mark-Simulacrum``
…crum Make `x.py --color always` apply to logging too Follow-up to rust-lang#78548, rust-lang#79004. r? ```@Mark-Simulacrum```
Fixes #78435.
See #78435 for more.
Cc @RalfJung @oli-obk