Skip to content

Commit 1828a49

Browse files
committed
use magenta instead of bold for highlighting
according to a poll of gay people in my phone, purple is the most popular color to use for highlighting | color | percentage | | ---------- | ---------- | | bold white | 6% | | blue | 14% | | cyan | 26% | | purple | 37% | | magenta | 17% | unfortunately, purple is not supported by 16-color terminals, which rustc apparently wants to support for some reason. until we require support for full 256-color terms (e.g. by doing the same feature detection as we currently do for urls), we can't use it. instead, i have collapsed the purple votes into magenta on the theory that they're close, and also because magenta is pretty.
1 parent 9f0c6f1 commit 1828a49

File tree

6 files changed

+58
-12
lines changed

6 files changed

+58
-12
lines changed

compiler/rustc_errors/src/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2719,7 +2719,7 @@ impl Style {
27192719
spec.set_bold(true);
27202720
}
27212721
Style::Highlight => {
2722-
spec.set_bold(true);
2722+
spec.set_fg(Some(Color::Magenta));
27232723
}
27242724
}
27252725
spec

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
1111
const ENTRY_LIMIT: usize = 900;
1212
// FIXME: The following limits should be reduced eventually.
1313
const ISSUES_ENTRY_LIMIT: usize = 1852;
14-
const ROOT_ENTRY_LIMIT: usize = 866;
14+
const ROOT_ENTRY_LIMIT: usize = 867;
1515

1616
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
1717
"rs", // test source files
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Make sure "highlighted" code is colored purple
2+
3+
// compile-flags: --error-format=human --color=always
4+
// error-pattern:for<'a> 
5+
// edition:2018
6+
7+
use core::pin::Pin;
8+
use core::future::Future;
9+
use core::any::Any;
10+
11+
fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<(
12+
dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
13+
)>>) {}
14+
15+
fn wrapped_fn<'a>(_: Box<(dyn Any + Send)>) -> Pin<Box<(
16+
dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
17+
)>> {
18+
Box::pin(async { Err("nope".into()) })
19+
}
20+
21+
fn main() {
22+
query(wrapped_fn);
23+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0308]: mismatched types
2+
 --> $DIR/highlighting.rs:22:11
3+
 |
4+
LL |  query(wrapped_fn);
5+
 |  ----- ^^^^^^^^^^ one type is more general than the other
6+
 |  |
7+
 |  arguments to this function are incorrect
8+
 |
9+
 = note: expected fn pointer `for<'a> fn(Box<(dyn Any + Send + 'a)>) -> Pin<_>`
10+
 found fn item `fn(Box<(dyn Any + Send + 'static)>) -> Pin<_> {wrapped_fn}`
11+
note: function defined here
12+
 --> $DIR/highlighting.rs:11:4
13+
 |
14+
LL | fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<(
15+
 |  ____^^^^^_-
16+
LL | |  dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
17+
LL | | )>>) {}
18+
 | |___-
19+
20+
error: aborting due to 1 previous error
21+
22+
For more information about this error, try `rustc --explain E0308`.

tests/ui/suggestions/multiline-multipart-suggestion.rs renamed to tests/ui/error-emitter/multiline-multipart-suggestion.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
// compile-flags: --error-format=human --color=always
2+
// error-pattern: missing lifetime specifier
23
// ignore-windows
34

4-
fn short(foo_bar: &Vec<&i32>) -> &i32 { //~ ERROR missing lifetime specifier
5+
fn short(foo_bar: &Vec<&i32>) -> &i32 {
56
&12
67
}
78

8-
fn long( //~ ERROR missing lifetime specifier
9+
fn long(
910
foo_bar: &Vec<&i32>,
1011
something_very_long_so_that_the_line_will_wrap_around__________: i32,
1112
) -> &i32 {
1213
&12
1314
}
1415

15-
fn long2( //~ ERROR missing lifetime specifier
16+
fn long2(
1617
foo_bar: &Vec<&i32>) -> &i32 {
1718
&12
1819
}

tests/ui/suggestions/multiline-multipart-suggestion.stderr renamed to tests/ui/error-emitter/multiline-multipart-suggestion.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0106]: missing lifetime specifier
2-
 --> $DIR/multiline-multipart-suggestion.rs:4:34
2+
 --> $DIR/multiline-multipart-suggestion.rs:5:34
33
 |
4-
LL | fn short(foo_bar: &Vec<&i32>) -> &i32 {
4+
LL | fn short(foo_bar: &Vec<&i32>) -> &i32 {
55
 |  ---------- ^ expected named lifetime parameter
66
 |
77
 = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from
88
help: consider introducing a named lifetime parameter
99
 |
10-
LL | fn short<'a>(foo_bar: &'a Vec<&'a i32>) -> &'a i32 {
10+
LL | fn short<'a>(foo_bar: &'a Vec<&'a i32>) -> &'a i32 {
1111
 | ++++ ++ ++ ++
1212

1313
error[E0106]: missing lifetime specifier
14-
 --> $DIR/multiline-multipart-suggestion.rs:11:6
14+
 --> $DIR/multiline-multipart-suggestion.rs:12:6
1515
 |
1616
LL |  foo_bar: &Vec<&i32>,
1717
 |  ----------
@@ -22,22 +22,22 @@
2222
 = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from
2323
help: consider introducing a named lifetime parameter
2424
 |
25-
LL ~ fn long<'a>(
25+
LL ~ fn long<'a>(
2626
LL ~  foo_bar: &'a Vec<&'a i32>,
2727
LL |  something_very_long_so_that_the_line_will_wrap_around__________: i32,
2828
LL ~ ) -> &'a i32 {
2929
 |
3030

3131
error[E0106]: missing lifetime specifier
32-
 --> $DIR/multiline-multipart-suggestion.rs:16:29
32+
 --> $DIR/multiline-multipart-suggestion.rs:17:29
3333
 |
3434
LL |  foo_bar: &Vec<&i32>) -> &i32 {
3535
 |  ---------- ^ expected named lifetime parameter
3636
 |
3737
 = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from
3838
help: consider introducing a named lifetime parameter
3939
 |
40-
LL ~ fn long2<'a>(
40+
LL ~ fn long2<'a>(
4141
LL ~  foo_bar: &'a Vec<&'a i32>) -> &'a i32 {
4242
 |
4343

0 commit comments

Comments
 (0)