Skip to content

rustc --color always doesn't always output color #151643

@JayanAXHF

Description

@JayanAXHF

Zulip discussion: #t-compiler > Rustc `--color always` doesn't always color output

While working on #150895, I discovered that some parts of rustc that use --color flag don't always output color when the flag is set to always.

Relevant Examples:

if io::stdout().is_terminal() {
show_md_content_with_pager(&text, color);
} else {
safe_print!("{text}");
}

let emit_color = if supports_color {
ColorConfig::from(color)
} else {
ColorConfig::Never
};

The check for terminal support should only occur when the option is set to auto. There may be more examples for this as well. These are just the two that I could find.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-error-codesArea: Explanation of an error code (--explain)C-bugCategory: This is a bug.D-inconsistentDiagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions