Skip to content

Cargo and rustc are using different tones of red for errors on the terminal #12740

@RalfJung

Description

@RalfJung
Member

Problem

Cargo and rustc are not consistent in terms of how they are coloring errors on the terminal.

Steps

  1. Run cargo check on a project with build failures.

image

As you can see, the two "error" are using two different shades of red. In terms of the colorize crate, rustc is using bright_red and cargo is using red.

Possible Solution(s)

One of cargo or rustc should switch to the other tone of red. I have a slight preference for "bright red", that's why I reported this as a cargo issue.

Notes

No response

Version

$ cargo version --verbose
cargo 1.72.0 (103a7ff2e 2023-08-15)
release: 1.72.0
commit-hash: 103a7ff2ee7678d34f34d778614c5eb2525ae9de
commit-date: 2023-08-15
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Debian n/a (trixie) [64-bit]

Activity

added
C-bugCategory: bug
S-triageStatus: This issue is waiting on initial triage.
on Sep 26, 2023
weihanglo

weihanglo commented on Sep 26, 2023

@weihanglo
Member

Thanks for the report!

We're aware of this and have #12627 for tracking one of the approach. See also #2290 (comment) for a short summary.

I lean to waiting for #12627 but also fine with manual tweaks.

weihanglo

weihanglo commented on Sep 26, 2023

@weihanglo
Member

Without investigating it by myself, do you know since which version this happened, or it has been there for a while?

added
S-needs-team-inputStatus: Needs input from team on whether/how to proceed.
and removed
S-triageStatus: This issue is waiting on initial triage.
on Sep 26, 2023
RalfJung

RalfJung commented on Sep 26, 2023

@RalfJung
MemberAuthor

I have no idea. I only just realized this when working on the messages for ui_test. It might have been like this for a while, it might have been hidden by me using a different terminal/configuration, it might be recent.

RalfJung

RalfJung commented on Sep 26, 2023

@RalfJung
MemberAuthor

I went back through time a bit -- this is definitely a very long-standing issue. I see the difference even with Rust 1.40.

epage

epage commented on Sep 26, 2023

@epage
Contributor

Glad to see this wasn't something I broke recently as I've been making changes to how we do styling :)

#12578 added styling to clap and #12655 made us use shared definitions to ensure we'd stay in sync which also made our style choices easier to audit.

Cargo uses bold+red and a lot of has likely haven't noticed the discrepancy because bold+red gets colored the same as bright_red in a lot of themes.

epage

epage commented on Sep 26, 2023

@epage
Contributor

We should probably do an audit of all colors used with their intended use and see where it'd work best to align.

Note that as follow ups to #12578 and #12655, cargo-fmt and cargo-clippy were also updated to align with cargo. I'm tempted to do this also to rustup but they hadn't upgrade to clap v4 last I checked.

added
S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.
and removed
S-needs-team-inputStatus: Needs input from team on whether/how to proceed.
on Sep 26, 2023
rami3l

rami3l commented on Sep 26, 2023

@rami3l
Member

I'm tempted to do this also to rustup but they hadn't upgrade to clap v4 last I checked.

@epage Oh we have just done that! (Thanks @djc for your rust-lang/rustup#3444!)

22 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.C-bugCategory: bugS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @epage@RalfJung@weihanglo@rami3l

      Issue actions

        Cargo and rustc are using different tones of red for errors on the terminal · Issue #12740 · rust-lang/cargo