Skip to content

Commit bb62232

Browse files
committed
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: 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 | ^^^^^^^^ ```
1 parent 3d5d7a2 commit bb62232

36 files changed

+2077
-277
lines changed

compiler/rustc_errors/src/emitter.rs

+534-113
Large diffs are not rendered by default.

compiler/rustc_errors/src/json.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ impl Diagnostic {
346346

347347
let buf = BufWriter::default();
348348
let mut dst: Destination = Box::new(buf.clone());
349-
let (short, color_config) = je.json_rendered.unzip();
349+
let short = matches!(je.json_rendered, HumanReadableErrorType::Short(_));
350+
let color_config = je.json_rendered.color_config();
350351
match color_config {
351352
ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)),
352353
ColorConfig::Never => {}

0 commit comments

Comments
 (0)