1 unstable release

0.2.0-alpha.0 Jan 30, 2023

#359 in Programming languages

Download history 2080/week @ 2023-06-10 1589/week @ 2023-06-17 1453/week @ 2023-06-24 1769/week @ 2023-07-01 1101/week @ 2023-07-08 841/week @ 2023-07-15 566/week @ 2023-07-22 672/week @ 2023-07-29 443/week @ 2023-08-05 303/week @ 2023-08-12 412/week @ 2023-08-19 472/week @ 2023-08-26 285/week @ 2023-09-02 302/week @ 2023-09-09 279/week @ 2023-09-16 157/week @ 2023-09-23

1,067 downloads per month

MIT license

1.5K SLoC


crates.io crates.io License actions-badge

A fancy compiler diagnostics crate.

This is a temporary fork for use by apollo-rs while we wait for a new release! Please do not rely on this.


Ariadne supports arbitrary multi-line spans
fn main() {
    use ariadne::{Color, ColorGenerator, Fmt, Label, Report, ReportKind, Source};

    let mut colors = ColorGenerator::new();

    // Generate & choose some colours for each of our elements
    let a = colors.next();
    let b = colors.next();
    let out = Color::Fixed(81);

    Report::build(ReportKind::Error, "sample.tao", 12)
        .with_message(format!("Incompatible types"))
            Label::new(("sample.tao", 32..33))
                .with_message(format!("This is of type {}", "Nat".fg(a)))
            Label::new(("sample.tao", 42..45))
                .with_message(format!("This is of type {}", "Str".fg(b)))
            Label::new(("sample.tao", 11..48))
                    "The values are outputs of this {} expression",
            "Outputs of {} expressions must coerce to the same type",
        .print(("sample.tao", Source::from(include_str!("sample.tao"))))

See examples/ for more examples.


For each error you wish to report:

  • Call Report::build() to create a ReportBuilder.
  • Assign whatever details are appropriate to the error using the various methods, and then call the finish method to get a Report.
  • For each Report, call print or eprint to write the report directly to stdout or stderr. Alternately, you can use write to send the report to any other Write destinarion (such as a file).


ariadne is a sister project of chumsky. Neither are dependent on one-another, but I'm working on both simultaneously and like to think that their features complement each other. If you're thinking of using ariadne to process your compiler's output, why not try using chumsky to process its input?


  • Inline and multi-line labels capable of handling arbitrary configurations of spans
  • Multi-file errors
  • Generic across custom spans and file caches
  • A choice of character sets to ensure compatibility
  • Coloured labels & highlighting with 8-bit and 24-bit color support (thanks to yansi)
  • Label priority and ordering
  • Compact mode for smaller diagnostics
  • Correct handling of variable-width characters such as tabs
  • A ColorGenerator type that generates distinct colours for visual elements.
  • A plethora of other options (tab width, label attach points, underlines, etc.)
  • Built-in ordering/overlap heuristics that come up with the best way to avoid overlapping & label crossover

Cargo Features

  • "concolor" enables integration with the concolor crate for global color output control across your application
  • "auto-color" enables concolor's "auto" feature for automatic color control

concolor's features should be defined by the top-level binary crate, but without any features enabled concolor does nothing. If ariadne is your only dependency using concolor then "auto-color" provides a convenience to enable concolor's automatic color support detection, i.e. this:

ariadne = { version = "...", features = ["auto-color"] }

is equivalent to this:

ariadne = { version = "...", features = ["concolor"] }
concolor = { version = "...", features = ["auto"] }

Planned Features

  • Improved layout planning & space usage
  • Non-ANSI terminal support
  • More accessibility options (screenreader-friendly mode, textured highlighting as an alternative to color, etc.)
  • More color options
  • Better support for layout restrictions (maximum terminal width, for example)


The API (should) follow semver. However, this does not apply to the layout of final error messages. Minor tweaks to the internal layout heuristics can often result in the exact format of error messages changing with labels moving slightly. If you experience a change in layout that you believe to be a regression (either the change is incorrect, or makes your diagnostics harder to read) then please open an issue.


Thanks to:

  • @brendanzab for their beautiful codespan crate that inspired me to try pushing the envelope of error diagnostics.

  • @estebank for showing innumerable people just how good compiler diagnostics can be through their work on Rust.