Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,11 @@ impl Destination {
Style::FileNameStyle | Style::LineAndColumn => {}
Style::LineNumber => {
try!(self.start_attr(term::Attr::Bold));
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE)));
if cfg!(windows) {
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN)));
} else {
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE)));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

let fg_color = if cfg!(windows) {
    term::color::BRIGHT_CYAN
} else {
    term::color::BRIGHT_BLUE
};
try!(self.start_attr(term::Attr::ForegroundColor(fg_color)));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or even

try!(self.start_attr(term::Attr::ForegroundColor(
    if cfg!(windows) {
        term::color::BRIGHT_CYAN
    } else {
        term::color::BRIGHT_BLUE
    }
)));

But these seem like pretty minor details?

Copy link
Contributor

Choose a reason for hiding this comment

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

But these seem like pretty minor details?

Yep, hence the "Nit" ;)

}
Style::ErrorCode => {
try!(self.start_attr(term::Attr::Bold));
Expand All @@ -896,6 +900,9 @@ impl Destination {
}
Style::OldSchoolNoteText | Style::HeaderMsg => {
try!(self.start_attr(term::Attr::Bold));
if cfg!(windows) {
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_WHITE)));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah... This is annoying for me since I use console with white background on Windows. These messages are completely invisible there. (Windows uses black background by default... but I'm used to seeing white background...) I guess a solution would be to detect the console setting in libterm (probably via GetConsoleScreenBufferInfo), and only apply these Windows-specific cases when the background is black...

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want a white background, couldn't you just invert the brightness of all the colors so the background is "black" but "black" actually means white, and "bright_white" actually means black?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, fair. I didn't know I can do that.

}
Style::UnderlinePrimary | Style::LabelPrimary => {
try!(self.start_attr(term::Attr::Bold));
Expand All @@ -904,7 +911,11 @@ impl Destination {
Style::UnderlineSecondary |
Style::LabelSecondary => {
try!(self.start_attr(term::Attr::Bold));
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE)));
if cfg!(windows) {
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN)));
} else {
try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE)));
}
}
Style::NoStyle => {}
Style::Level(l) => {
Expand Down
8 changes: 7 additions & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,13 @@ impl Level {
pub fn color(self) -> term::color::Color {
match self {
Bug | Fatal | PhaseFatal | Error => term::color::BRIGHT_RED,
Warning => term::color::YELLOW,
Warning => {
if cfg!(windows) {
term::color::BRIGHT_YELLOW
} else {
term::color::YELLOW
}
},
Note => term::color::BRIGHT_GREEN,
Help => term::color::BRIGHT_CYAN,
Cancelled => unreachable!(),
Expand Down