Login
You're viewing the fosstodon.org public feed.
  • Nov 18, 2026, 4:24 AM

    If you use nightly Rust and run rustup update, you'll find a new goodie tonight that I'm particularly happy about: experimental "no graphics" diagnostics in `cargo` behind the flag `-Zterm-graphics` and in `rustc` behind the flags `-Znightly-features --error-format=human-no-graphics`. (These names will likely change.)

    You can permanently turn this feature on, which will only take effect in nightly, by adding the following to your `.cargo/config.toml`, which will be used on nightly and ignored on stable:

    ```
    [unstable]
    term-graphics = true
    ```

    If you also add `NO_GRAPHICS=1` to your environment flags, the all of your builds using nightly will use the new output.

    In lieu of the environment variable, you can also add the following to your `.cargo/config.toml`, but this will make stable `cargo` complain about an unused config key:
    ```
    [term]
    graphics = false
    ```

    Once the feature is stable, it will be much smoother, but expect rough edges at this time. Do let us know about them when you encounter them!

    #RustLang #Rust #a11y #Accessibility

    Current rustc ASCII-art output:

warning: unused import: `std::fmt::Write`
 --> examples/simple.rs:1:5
  |
1 | use std::fmt::Write;
  |     ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
    NO_GRAPHICS rustc output:

warning: unused import: `std::fmt::Write`
 at examples/simple.rs:1:5
 note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
    💬 4🔄 45⭐ 51

Replies

  • Nov 18, 2026, 4:27 AM

    What this new mode does is tweak the way that all diagnostics in `cargo` and `rustc` are rendered, avoiding the ASCII art, making it, hopefully, more suitable for users relying on screen-readers/Text-To-Speech and Braille displays. It also has the side-effect of being a more compact output, which might interest people for whom the `rustc` output was always bothersome in its verbosity, but that considered `--message-format=short` to be *too* terse.

    #RustLang #Rust #a11y #Accessibility

    Current rustc output.
    warning: unnecessary parentheses around match arm expression
 at examples/multiple-diagnostics.rs:124:17
 note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
 on line 124, column 17
 on line 215, column 9

error E0308: `match` arms have incompatible types
 at examples/multiple-diagnostics.rs:99:18 to 121:10: expected `()`, found `&str`
  on line 7, column 13: `match` arms have incompatible types
  on line 8, column 17 to line 98, column 10: this is found to be of type `()`

error E0308: `match` arms have incompatible types
 at examples/multiple-diagnostics.rs:216:18 to 239:10: expected integer, found `&str`
  on line 123, column 13: `match` arms have incompatible types
  on line 124, column 17 to line 215, column 10: this is found to be of type `{integer}`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `blog-examples` (example "multiple-diagnostics") due to 2 previous errors; 1 warning emitted
    rustc short format:

examples/multiple-diagnostics.rs:124:17: warning: unnecessary parentheses around match arm expression
examples/multiple-diagnostics.rs:99:18: error[E0308]: `match` arms have incompatible types: expected `()`, found `&str`
examples/multiple-diagnostics.rs:216:18: error[E0308]: `match` arms have incompatible types: expected integer, found `&str`
error: could not compile `blog-examples` (example "multiple-diagnostics") due to 2 previous errors; 1 warning emitted
    rustc Unicode renderer
    💬 3🔄 19⭐ 30
  • Nov 18, 2026, 4:27 AM

    Both @muscraft and I want to give our apologies to the blind community. It is embarrassing that it took this long to provide proper support for you in the Rust toolchain. I hope that we can continue building on this and give you the developer experience that you deserve.

    I must emphasize that I believe that we have an output that will work great for most people, but as someone who is *not* an expert on assistive technologies, nor a daily user of them, I am sure there are things that we missed that could be improved. Consider this an open and standing request for feedback on this feature.

    #RustLang #Rust #a11y #Accessibility

    💬 2🔄 17⭐ 42
  • Nov 18, 2026, 4:28 AM

    This work was envisioned several years ago, discussed endlessly between different people in the project, gathering requirements and trying to come up with a useful design. In a very real sense, this really started with @soph's work over a decade ago, when she led the work to overhaul the design vocabulary of Rust diagnostics blog.rust-lang.org/2016/08/10/. Her original work still looms and underpins everything that has come since, and the flexibility of that design allowed for separating the semantic content of errors from their rendering, which meant that changing how things *look* doesn't require any changes to `rustc`. The work we've already done in evolving the content of diagnostics, like shown in kobzol.github.io/rust/rustc/20 and that you could see for yourself by running git.donsz.nl/jana/errorversion, already does the heavy lifting.

    I recall starting conversations about having an output suitable using assistive technologies like screen-readers on almost every RustConf and RustWeek I've attended, specially spending time with @epage and @muscraft hunched over laptops on cardboard tables or arguing over tikka masala and beers on what the best design could be. There's plenty of prior art, but one example is from @zkat's Miette, another diagnostic renderer for Rust: toot.cat/@zkat/115584770971710. I *believe* they are the ones that came up with the `NO_GRAPHICS=1` environment flag, mimicking `NO_COLOR=1` no-color.org/.

    #RustLang #Rust

    💬 1🔄 9⭐ 16
  • Nov 18, 2026, 4:30 AM

    This was also partly made possible by the use of annotate-snippets-rs. crates.io/crates/annotate-snip

    That crate effectively started life as a copy of `rustc`'s own home grown renderer, quirks and all. Manish Goregaokar made the effort of introducing it as a dependency in `rustc` with the objective of eventually deprecating the custom one. But that objective remained elusive for years. It turns out that making a general purpose renderer is hard, and in the meantime I kept adding custom behavior into `rustc`'s renderer to account for the myriad corner cases that terminals expose us to (reminder that `rustc` separates Unicode families—for good reasons play.rust-lang.org/?version=st). But after @muscraft took over the project, progress accelerated significantly. Little by little he whittled away all of the differences, all the corner cases and hacks and cruft that had accumulated over the years, significantly improved the codebase, to the point that we could switch `rustc` to use annotate-snippets-rs exclusively. Today, the `rustc` renderer has been removed, and All Is Right With The World.

    Having the renderer in a separate repo meant that iterating on designs didn't require recompiling *all of `rustc`*, and that experiments could be done independently of what `rustc` needed.

    #RustLang #Rust

    💬 1🔄 0⭐ 6
  • Nov 18, 2026, 4:30 AM

    These efforts culminated in a rapid-fire sequence of PRs. Support in annotate-snippets-rs landed in github.com/rust-lang/annotate-.

    The Rust Compiler Team approval happened in github.com/rust-lang/compiler-. `rustc` support landed in github.com/rust-lang/rust/pull. `cargo` support landed in github.com/rust-lang/cargo/pul. And as of a couple of hours ago, all of these pieces landed on nightly. The tracking issue for stabilizing this new output is at github.com/rust-lang/rust/issu, but that will require some bake time, and addressing any issues that will innevitably come up.

    As additional context, this work is also similar to the Unicode-art output that is also in nightly. That one was, if anything, easier: all it had to do was add some logic for the more expressive power of Unicode Box Drawing characters over ASCII, but the output didn't *fundamentally* change. It is barely a face-lift.

    #RustLang #Rust

    💬 1🔄 0⭐ 4
  • Nov 18, 2026, 4:31 AM

    Overall, I'm really happy with the results. Scott did a great job evolving the design beyond what I'd originally envisioned, and had a lot of patience receiving my nitpicks and requests for improvements before a single PR had even landed anywhere.

    I want to reiterate my request for feedback and my sincere apology this took so long.

    #RustLang #Rust #a11y #Accessibility

    💬 2🔄 0⭐ 14
  • 💬 1🔄 2⭐ 2
  • Nov 18, 2026, 5:02 AM

    @muscraft @ekuber Okay, while we're talking. Is there a reason it's indented? It doesn't bother me much and could actually be a convenient shortcut thanks to NVDA add-ons like indent nav, but am wondering if the two spaces before the location of an error is for any particular reason? (yes, I notice every character, haha).

    💬 1🔄 0⭐ 2
  • Nov 18, 2026, 5:14 AM

    @TheQuinbox @muscraft Part of the thought is similar to it also supporting color: we expect people who just want less verbose output to also use this. Visually it helps people scanning see a hierarchy. We were also hoping that it would help tooling notice structure from the indentation, which from the sound of it it would? And yes, I am impressed. I think that even most sighted people might not even notice the 1 or 2 char leading whitespace 😁

    💬 3🔄 0⭐ 2
  • 💬 0🔄 0⭐ 4
  • Nov 18, 2026, 12:18 PM

    @ekuber @TheQuinbox @muscraft A principle for all of us that I want to emphasize is that this is for screen readers. We will only improve things for other use cases so long as they don't compromise our screen reader support.

    💬 0🔄 0⭐ 4
  • 💬 0🔄 0⭐ 1
  • Nov 18, 2026, 5:31 AM

    @ekuber Iterating closely on design before merging code pays off immensely for usability. It will be interesting to see how other compiled languages handle similar terminal constraints.

    💬 1🔄 0⭐ 1
  • 💬 0🔄 0⭐ 3
  • Nov 18, 2026, 5:31 AM

    @ekuber Reaching out directly to screen reader users is the best way to catch edge cases early. Automated tests often miss how announcements handle rapid output changes.

    💬 1🔄 0⭐ 1
  • Nov 18, 2026, 5:33 AM

    @qaurlreview This was part of desire to get this into nightly: real people can actually exercise this new output and find those edge cases. Even after stabilization, the human readable output of the compiler is not part of the stability guarantees so we can continue iterating over it even then.

    💬 0🔄 0⭐ 4
  • Nov 18, 2026, 5:31 AM

    @ekuber That compact output is a welcome bonus for CI logs too. Do you expect this cleaner text structure will become the default format eventually?

    💬 1🔄 0⭐ 2
  • Nov 18, 2026, 5:37 AM

    @qaurlreview Likely not the default, but enabling it should be as easy as possible. Might even make asking the user for their preference part of `rustup`'s initial installation (but can't promise anything at this time, things are still in flux).

    💬 0🔄 0⭐ 3
  • Nov 18, 2026, 12:53 PM

    @ekuber @TheQuinbox This will likely also make the output more friendly to agents, which don't have the same kind of ASCII spatial perception that sighted humans do. They can handle it for sure, but it comes less naturally to them.

    💬 0🔄 0⭐ 0
  • Nov 18, 2026, 5:31 AM

    @ekuber Removing ASCII art makes a massive difference for screen reader navigation. Have you tested how nested error traces sound with this new layout compared to the standard format?

    💬 1🔄 0⭐ 1
  • Nov 18, 2026, 5:41 AM

    @qaurlreview That is my hope. I've done some experiments, but as I am not a daily driver I can't tell you how much the usability is improved under different systems, particularly on terminals. I hope that the minor indentation and empty lines in between errors allows for good structured navigation, while I hope that the spelled out line and column positions are pleasant enough while retaining utility. I know that some tools allow for picking up paths with line and column, but keeping the redundant path felt like it would hurt more than it helps. But only user feedback can tell me if my intuitions are correct.

    💬 0🔄 0⭐ 2
  • Nov 18, 2026, 5:31 AM

    @ekuber holy shit I remember bringing this up when you asked, but always knew it would be a lot of work. I didn’t even know it was being worked on but this is such a nice surprise! I might actually break my no nightly rule and start doing my dev work in nightly purely for this and my braille display.

    💬 1🔄 0⭐ 3
  • Nov 18, 2026, 5:35 AM

    @mythra You can use nightly for "daily driving" and use stable for "production builds". That's generally what I do for myself. I used to advice newcomers to do that back when diagnostics were improving at a rapid pace. They still improve, but the baseline has gotten good enough that it doesn't feel like malpractice to not nudge people towards nightly for the developer experience.

    💬 1🔄 0⭐ 2
  • 💬 0🔄 0⭐ 2
  • Nov 18, 2026, 9:27 AM

    @ekuber the no-graphics output is a meaningful step. one regression i'm curious about is multi-span errors with nested suggestions: do you have snapshot tests to keep the reading order and source locations predictable across renderers? that seems worth catching before the flags stabilize.

    💬 1🔄 0⭐ 0
  • Nov 18, 2026, 6:31 PM

    @ademisler @ekuber I am not exactly sure what you mean by "multi-span errors with nested suggestions". Are you referring to something like either of these?
    - github.com/rust-lang/annotate-
    - github.com/rust-lang/annotate-

    Regardless, we don't have any tests that explicitly check for consistency between the renderers, but I am not sure how likely divergences would be given that both renderers operate on the same internal structures.

    💬 1🔄 0⭐ 0
  • Nov 18, 2026, 8:49 PM

    @muscraft @ekuber yes, those are close to what i meant. i'm thinking of diagnostics with a primary span, secondary locations and a suggested replacement. even if both renderers share the same internal data, dropping the visual gutter can change the reading order or make a suggestion look attached to the wrong span. a snapshot test of those two examples across both modes, checking line/column order and suggestion association, would catch that.

    💬 0🔄 0⭐ 0