about summary refs log tree commit diff
path: root/library/alloc/src/macros.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-03-08 01:27:22 -0500
committerGitHub <noreply@github.com>2025-03-08 01:27:22 -0500
commit2c374e3e2140f6016b75a0de0d790fb5b766291f (patch)
treef679d59b871f2f0245ad2f14538cef345b685ef6 /library/alloc/src/macros.rs
parentdfae8e8e4c1640c90d4ec108eeef37ae84985f66 (diff)
parentdb2fb7102ec8eeb6ec9a0cb55ab1a120eeb0a730 (diff)
downloadrust-2c374e3e2140f6016b75a0de0d790fb5b766291f.tar.gz
rust-2c374e3e2140f6016b75a0de0d790fb5b766291f.zip
Rollup merge of #137757 - estebank:trim-spans, r=davidtwco
On long spans, trim the middle of them to make them fit in the terminal width

When encountering a single line span that is wider than the terminal, we keep context at the start and end of the span but otherwise remove the code from the middle. This is somewhat independent from whether the left and right margins of the output have been trimmed as well.

```
error[E0308]: mismatched types
  --> $DIR/long-span.rs:6:15
   |
LL | ... = [0, 0, 0, 0, ..., 0, 0];
   |       ^^^^^^^^^^^^^...^^^^^^^ expected `u8`, found `[{integer}; 1681]`
```

Address part of https://github.com/rust-lang/rust/issues/137680 (missing handling of the long suggestion). Fix https://github.com/rust-lang/rust/issues/125581.

---

Change the way that underline positions are calculated by delaying using the "visual" column position until the last possible moment, instead using the "file"/byte position in the file, and then calculating visual positioning as late as possible. This should make the underlines more resilient to non-1-width unicode chars.

Unfortunately, as part of this change (which fixes some visual bugs) comes with the loss of some eager tab codepoint handling, but the output remains legible despite some minor regression on the "margin trimming" logic.

---

`-Zteach` is perma-unstable, barely used, the highlighting logic buggy and the flag being passed around is tech-debt. We should likely remove `-Zteach` in its entirely.
Diffstat (limited to 'library/alloc/src/macros.rs')
0 files changed, 0 insertions, 0 deletions