Skip to content

Commit e2962cc

Browse files
committed
Auto merge of rust-lang#126597 - estebank:unicode-output, r=fmease
Add Unicode block-drawing compiler output support Add nightly-only theming support to rustc output using Unicode box drawing characters instead of ASCII-art to draw the terminal UI. In order to enable, the flags `-Zunstable-options=yes --error-format=human-unicode` must be passed in. After: ``` error: foo ╭▸ test.rs:3:3 │ 3 │ X0 Y0 Z0 │ ┌───╿──│──┘ │ ┌│───│──┘ │ ┏││━━━┙ │ ┃││ 4 │ ┃││ X1 Y1 Z1 5 │ ┃││ X2 Y2 Z2 │ ┃│└────╿──│──┘ `Z` label │ ┃└─────│──┤ │ ┗━━━━━━┥ `Y` is a good letter too │ `X` is a good letter ╰╴ note: bar ╭▸ test.rs:4:3 │ 4 │ ┏ X1 Y1 Z1 5 │ ┃ X2 Y2 Z2 6 │ ┃ X3 Y3 Z3 │ ┗━━━━━━━━━━┛ ├ note: bar ╰ note: baz note: qux ╭▸ test.rs:4:3 │ 4 │ X1 Y1 Z1 ╰╴ ━━━━━━━━ ``` Before: ``` error: foo --> test.rs:3:3 | 3 | X0 Y0 Z0 | ___^__-__- | |___|__| | ||___| | ||| 4 | ||| X1 Y1 Z1 5 | ||| X2 Y2 Z2 | |||____^__-__- `Z` label | ||_____|__| | |______| `Y` is a good letter too | `X` is a good letter | note: bar --> test.rs:4:3 | 4 | / X1 Y1 Z1 5 | | X2 Y2 Z2 6 | | X3 Y3 Z3 | |__________^ = note: bar = note: baz note: qux --> test.rs:4:3 | 4 | X1 Y1 Z1 | ^^^^^^^^ ``` After: ![rustc output with unicode box drawing characters](https://github.com/rust-lang/rust/assets/1606434/d210b79a-6579-4407-9706-ba8edc6e9f25) Before: ![current rustc output with ASCII art](https://github.com/rust-lang/rust/assets/1606434/5aecccf8-a6ee-4469-8b39-72fb0d979a9f)
2 parents c21c781 + da93d78 commit e2962cc

6 files changed

+28
-28
lines changed

tests/ui/empty_line_after/doc_comments.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: empty line after doc comment
33
|
44
LL | / /// for the crate
55
LL | |
6-
| |_
6+
| |_^
77
LL | fn first_in_crate() {}
88
| ------------------- the comment documents this function
99
|
@@ -22,7 +22,7 @@ error: empty line after doc comment
2222
|
2323
LL | / /// for the module
2424
LL | |
25-
| |_
25+
| |_^
2626
LL | fn first_in_module() {}
2727
| -------------------- the comment documents this function
2828
|
@@ -39,7 +39,7 @@ error: empty line after doc comment
3939
|
4040
LL | / /// # Indented
4141
LL | |
42-
| |_
42+
| |_^
4343
LL | /// Blank line
4444
LL | fn indented() {}
4545
| ------------- the comment documents this function
@@ -55,7 +55,7 @@ error: empty line after doc comment
5555
|
5656
LL | / /// This should produce a warning
5757
LL | |
58-
| |_
58+
| |_^
5959
LL | fn with_doc_and_newline() {}
6060
| ------------------------- the comment documents this function
6161
|
@@ -69,7 +69,7 @@ LL | |
6969
LL | | /** This is also a doc comment and is part of the warning
7070
LL | | */
7171
LL | |
72-
| |_
72+
| |_^
7373
...
7474
LL | fn three_attributes() {}
7575
| --------------------- the comment documents this function
@@ -82,7 +82,7 @@ error: empty line after doc comment
8282
LL | / /// docs for `old_code`
8383
LL | | // fn old_code() {}
8484
LL | |
85-
| |_
85+
| |_^
8686
LL | fn new_code() {}
8787
| ------------- the comment documents this function
8888
|
@@ -102,7 +102,7 @@ LL | | /// Docs
102102
LL | | /// for OldB
103103
LL | | // struct OldB;
104104
LL | |
105-
| |_
105+
| |_^
106106
...
107107
LL | struct Multiple;
108108
| --------------- the comment documents this struct
@@ -125,7 +125,7 @@ LL | / /**
125125
LL | | * Meant to be inner doc comment
126126
LL | | */
127127
LL | |
128-
| |_
128+
| |_^
129129
LL | fn first_in_module() {}
130130
| -------------------- the comment documents this function
131131
|
@@ -143,7 +143,7 @@ LL | | * Docs for `old_code`
143143
LL | | */
144144
LL | | /* fn old_code() {} */
145145
LL | |
146-
| |_
146+
| |_^
147147
...
148148
LL | fn new_code() {}
149149
| ------------- the comment documents this function
@@ -161,7 +161,7 @@ error: empty line after doc comment
161161
LL | / /// Docs for `old_code2`
162162
LL | | /* fn old_code2() {} */
163163
LL | |
164-
| |_
164+
| |_^
165165
LL | /// Docs for `new_code2`
166166
LL | fn new_code2() {}
167167
| -------------- the comment documents this function

tests/ui/empty_line_after/outer_attribute.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: empty line after outer attribute
33
|
44
LL | / #[crate_type = "lib"]
55
LL | |
6-
| |_
6+
| |_^
77
LL | fn first_in_crate() {}
88
| ------------------- the attribute applies to this function
99
|
@@ -20,7 +20,7 @@ error: empty line after outer attribute
2020
|
2121
LL | / #[inline]
2222
LL | |
23-
| |_
23+
| |_^
2424
LL | /// some comment
2525
LL | fn with_one_newline_and_comment() {}
2626
| --------------------------------- the attribute applies to this function
@@ -32,7 +32,7 @@ error: empty line after outer attribute
3232
|
3333
LL | / #[inline]
3434
LL | |
35-
| |_
35+
| |_^
3636
LL | fn with_one_newline() {}
3737
| --------------------- the attribute applies to this function
3838
|
@@ -44,7 +44,7 @@ error: empty lines after outer attribute
4444
LL | / #[crate_type = "lib"]
4545
LL | |
4646
LL | |
47-
| |_
47+
| |_^
4848
LL | fn with_two_newlines() {}
4949
| ---------------------- the attribute applies to this function
5050
|
@@ -59,7 +59,7 @@ error: empty line after outer attribute
5959
|
6060
LL | / #[doc = "doc attributes should be considered attributes"]
6161
LL | |
62-
| |_
62+
| |_^
6363
LL | enum Baz {
6464
| -------- the attribute applies to this enum
6565
|
@@ -70,7 +70,7 @@ error: empty line after outer attribute
7070
|
7171
LL | / #[repr(C)]
7272
LL | |
73-
| |_
73+
| |_^
7474
LL | struct Foo {
7575
| ---------- the attribute applies to this struct
7676
|
@@ -81,7 +81,7 @@ error: empty line after outer attribute
8181
|
8282
LL | / #[allow(dead_code)]
8383
LL | |
84-
| |_
84+
| |_^
8585
LL | mod foo {}
8686
| ------- the attribute applies to this module
8787
|
@@ -93,7 +93,7 @@ error: empty line after outer attribute
9393
LL | / #[inline]
9494
LL | | // Still lint cases where the empty line does not immediately follow the attribute
9595
LL | |
96-
| |_
96+
| |_^
9797
LL | fn comment_before_empty_line() {}
9898
| ------------------------------ the attribute applies to this function
9999
|
@@ -106,7 +106,7 @@ LL | / #[allow(unused)]
106106
LL | |
107107
LL | | // This comment is isolated
108108
LL | |
109-
| |_
109+
| |_^
110110
LL | pub fn isolated_comment() {}
111111
| ------------------------- the attribute applies to this function
112112
|

tests/ui/four_forward_slashes.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
33
|
44
LL | / //// whoops
55
LL | | fn a() {}
6-
| |_
6+
| |_^
77
|
88
= note: `-D clippy::four-forward-slashes` implied by `-D warnings`
99
= help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`
@@ -18,7 +18,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
1818
LL | / //// whoops
1919
LL | | #[allow(dead_code)]
2020
LL | | fn b() {}
21-
| |_
21+
| |_^
2222
|
2323
help: make this a doc comment by removing one `/`
2424
|
@@ -32,7 +32,7 @@ LL | / //// whoops
3232
LL | | //// two borked comments!
3333
LL | | #[track_caller]
3434
LL | | fn c() {}
35-
| |_
35+
| |_^
3636
|
3737
help: turn these into doc comments by removing one `/`
3838
|
@@ -46,7 +46,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
4646
LL | / //// between attributes
4747
LL | | #[allow(dead_code)]
4848
LL | | fn g() {}
49-
| |_
49+
| |_^
5050
|
5151
help: make this a doc comment by removing one `/`
5252
|
@@ -58,7 +58,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
5858
|
5959
LL | / //// not very start of contents
6060
LL | | fn h() {}
61-
| |_
61+
| |_^
6262
|
6363
help: make this a doc comment by removing one `/`
6464
|

tests/ui/four_forward_slashes_first_line.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
33
|
44
LL | / //// borked doc comment on the first line. doesn't combust!
55
LL | | fn a() {}
6-
| |_
6+
| |_^
77
|
88
= note: `-D clippy::four-forward-slashes` implied by `-D warnings`
99
= help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`

tests/ui/too_long_first_doc_paragraph-fix.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | | /// A much longer explanation that goes into a lot more detail about
66
LL | | /// how the thing works, possibly with doclinks and so one,
77
LL | | /// and probably spanning a many rows. Blablabla, it needs to be over
88
LL | | /// 200 characters so I needed to write something longeeeeeeer.
9-
| |_
9+
| |_^
1010
|
1111
= note: `-D clippy::too-long-first-doc-paragraph` implied by `-D warnings`
1212
= help: to override `-D warnings` add `#[allow(clippy::too_long_first_doc_paragraph)]`

tests/ui/too_long_first_doc_paragraph.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ error: first doc comment paragraph is too long
2323
LL | / /// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
2424
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
2525
LL | | /// gravida non lacinia at, rhoncus eu lacus.
26-
| |_
26+
| |_^
2727

2828
error: first doc comment paragraph is too long
2929
--> tests/ui/too_long_first_doc_paragraph.rs:36:1
@@ -32,7 +32,7 @@ LL | / /// Lorem
3232
LL | | /// ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
3333
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
3434
LL | | /// gravida non lacinia at, rhoncus eu lacus.
35-
| |_
35+
| |_^
3636

3737
error: aborting due to 3 previous errors
3838

0 commit comments

Comments
 (0)