PackageTrack
Sign in Get early access

codespan-reporting

Beautiful diagnostic reporting for text-based programming languages

0.13.1 132M downloads/mo #684 most downloaded on crates.io brendanzab/codespan

What this package is like to depend on

Last release 10 months ago

22 Oct 2025

Ships unpredictably

gaps range from 2 weeks to 4.1 years

Some releases are documented

notes for 12 of 25 stable releases

Nothing withdrawn

no release was ever pulled

8 years old

25 releases · first in 2018

2 releases in the last 12 months

see the full history below

Release timeline

25 releases · Apr 2018 to Oct 2025
2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 25
  1. 0.13.1 22 Oct 2025
    Release notes

    Release: codespan to 0.13.1, codespan-reporting to 0.13.1 and codespa…

    Open source →
    Release notes

    Version 0.13.1 fixes a few issues present in version 0.13.0.

    • Allow writing to &mut dyn WriteStyle #402
    • Fix an issue with str::from_utf8 not being available on rust 1.67 #405
    • Fix release action #408
    • Fix regression in the API with_note #409

    Thanks to contributors and those who raised issues. Keep them coming!

    Open source →
  2. 0.13.0 15 Oct 2025
    Release notes

    Release: codespan 0.13.0

    Open source →
    Release notes

    Release 0.13.0 adds a new rendering decoration system for reporting. It also includes a bug fix.

    New features

    In #387 @urisinger changed diagnostic emitting to be based on a new writer trait WriteStyle. This addition allows more flexibility in the output of emitting diagnostics. For example the default terminal ANSI style can be swapped out for SVG tag generation (see example). The change includes std::term::config::styles::StylesWriter and std::term::config::styles::Styles for customisation of colours and other decoration during emit.

    This feature is backwards compatible with original termcolor writers.

    Bug fixes and user changes

    The 0.12.0 version of codespan included ![no_std] support thanks to PR #374. Unfortunately, there were a few issues with it that were not caught by CI and went under the radar such as tests not passing under --no-default-features #399.

    Another issue included complications with std::io::Write vs core::fmt::Write. This meant that String would work under --no-default-features but break with --feature std.

    PR #400 adds checks for tests across feature configurations and adds different emit functions for different types of writers used. This includes a emit_to_string function that should work across feature configuration.

    There still needs to be improvements in this area but I have not landed on anything simple.

    WIP: It also adds a check to dependants of the library to check whether changes are compatible.

    If you find any issues or have a feature suggestion, leave them in the issues.

    Full Changelog: release/codespan-0.12.0...release/codespan-0.13.0

    Open source →
  3. 0.12.0 22 Mar 2025
    Release notes

    Update codespan-reporting to 0.12.0

    Open source →
    Release notes

    This release is version 0.12.0 of the codespan crate. A library the provides "Beautiful diagnostic reporting for text-based programming languages".

    This release contains a few bug fixes and small changes, there are no new features of breaking changes.

    New maintainer

    I (@kaleidawave) have been graciously added as a maintainer to this repository and have been gifted permission to publish updates to codespan-reporting (and other crates in the repository) on crates.io by the original maintainer.

    I hope that I can keep this project up to date and make sure that additions (such as seen below) can in the future be released under a shorter time frame.

    If you have any feature requests or changes for this project/crate, then don't hesitate to ping me.

    What's Changed

    Auto-generated by GitHub

    Full Changelog: v0.11.1...release/codespan-0.12.0

    Open source →
  4. 0.11.1 25 Feb 2021
    Release notes

    Update codespan to 0.11.1

    Open source →
    Release notes

    Added

    • Add Chars::{box_drawing, ascii} functions, the latter supporting a rustc-style of output that only uses ASCII characters (not above U+007F) for use cases that do not allow for box drawing characters, e.g. terminals that do not support them.

    Changed

    • Diagnostic::with_labels and Diagnostic::with_notes now append additional labels rather tan overwriting them, meaning that the documentation and behaviour match more closely. The behaviour will only differ if you call the same builder methods multiple times. If you call every builder method once only, nothing should change.
    • config::Chars::snippet_start is now a String instead of a single char.
    Open source →
  5. 0.11.0 29 Nov 2020
    Release notes

    There is now a code of conduct and a contributing guide.

    Some versions were skipped to sync up with the codespan-lsp crate. The release process has been changed so this should not happen again.

    Added

    • If a label spans over multiple lines, not all lines are rendered. The number of lines rendered at beginning and end is configurable separately.
    • There is now a custom error type.
    • There now is a medium rendering mode that is like the short rendering mode but also shows notes from the diagnostic.
    • PartialEq and Eq implementations for the diagnostic::{Diagnostic, Label, Severity} types.

    Changed

    • All errors now use the error type codespan_reporting::file::Error. This type also replaces the custom error type for codespan-lsp.

    Fixed

    • Empty error codes are not rendered.
    • The locus ("location of the diagnostic") is now computed so it is always at the first primary label, or at the first secondary label if no primary labels are available.
    • All unwraps outside of tests and examples have been removed.
    • Some internal improvements, including various code style improvements by using Clippy.
    • Improved documentation, also mentioning how the ordering of labels is handled.
    Open source →
  6. 0.9.5 24 Jun 2020
    Release notes

    Changed

    • Sections of source code that are marked with primary labels are now rendered using the primary highlight color.

    • Tab stops are now rendered properly.

      We used to just render \t characters in source snippets with the same number of spaces.

      <details> <summary>Example</summary>

      For example, when rendering with a tab width of 3 we would print:

      warning: tab test
        ┌─ tab_columns:1:2
        │
      1 │    hello
        │    ^^^^^
      2 │ ∙   hello
        │     ^^^^^
      3 │ ∙∙   hello
        │      ^^^^^
      4 │ ∙∙∙   hello
        │       ^^^^^
      5 │ ∙∙∙∙   hello
        │        ^^^^^
      6 │ ∙∙∙∙∙   hello
        │         ^^^^^
      7 │ ∙∙∙∙∙∙   hello
        │          ^^^^^
      

      Now we properly take into account the column of the tab character:

      warning: tab test
        ┌─ tab_columns:1:2
        │
      1 │    hello
        │    ^^^^^
      2 │ ∙  hello
        │    ^^^^^
      3 │ ∙∙ hello
        │    ^^^^^
      4 │ ∙∙∙   hello
        │       ^^^^^
      5 │ ∙∙∙∙  hello
        │       ^^^^^
      6 │ ∙∙∙∙∙ hello
        │       ^^^^^
      7 │ ∙∙∙∙∙∙   hello
        │          ^^^^^
      

      </details>

    Open source →
  7. 0.9.4 18 May 2020
    Release notes

    Changed

    • We have made the caret rendering easier to read when there are multiple labels on the same line. We also avoid printing trailing borders on the final source source snippet if no notes are present.

      <details> <summary>Example</summary>

      Instead of this:

         ┌─ one_line.rs:3:5
         │
       3 │     v.push(v.pop().unwrap());
         │     - first borrow later used by call
         │       ---- first mutable borrow occurs here
         │            ^ second mutable borrow occurs here
         │
      

      …we now render the following:

         ┌─ one_line.rs:3:5
         │
       3 │     v.push(v.pop().unwrap());
         │     - ---- ^ second mutable borrow occurs here
         │     │ │
         │     │ first mutable borrow occurs here
         │     first borrow later used by call
      

      </details>

    Fixed

    • Diagnostic rendering no longer panics if label ranges are between UTF-8 character boundaries.
    Open source →
  8. 0.9.3 29 Apr 2020
    Release notes

    Changed

    • Some panics were fixed when invalid unicode boundaries are supplied.

    • Labels that marked the same span were originally rendered in reverse order. This was a mistake! We've now fixed this.

      <details> <summary>Example</summary>

      For example, this diagnostic:

         ┌─ same_range:1:7
         │
       1 │ ::S { }
         │     - Expected '('
         │     ^ Unexpected '{'
         │
      

      …will now be rendered as:

         ┌─ same_range:1:7
         │
       1 │ ::S { }
         │     ^ Unexpected '{'
         │     - Expected '('
         │
      

      </details>

    • We've reduced the prominence of the 'locus' on source snippets by simplifying the border and reducing the spacing around it. This is to help focus attention on the underlined source snippet and error messages, rather than the location, which should be a secondary focus.

      <details> <summary>Example</summary>

      For example we originally rendered this:

      error: unknown builtin: `NATRAL`
      
         ┌── Data/Nat.fun:7:13 ───
         │
       7 │ {-# BUILTIN NATRAL Nat #-}
         │             ^^^^^^ unknown builtin
         │
         = there is a builtin with a similar name: `NATURAL`
      
      

      …and now we render this:

      error: unknown builtin: `NATRAL`
        ┌─ Data/Nat.fun:7:13
        │
      7 │ {-# BUILTIN NATRAL Nat #-}
        │             ^^^^^^ unknown builtin
        │
        = there is a builtin with a similar name: `NATURAL`
      
      

      </details>

    Open source →
  9. 0.9.2 29 Mar 2020
    Release notes

    Changed

    • Render overlapping multiline marks on the same lines of source code.

      <details> <summary>Example</summary>

      For example:

      error[E0308]: match arms have incompatible types
      
         ┌── codespan/src/file.rs:1:9 ───
         │
       1 │ ╭         match line_index.compare(self.last_line_index()) {
       2 │ │             Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
       3 │ │             Ordering::Equal => Ok(self.source_span().end()),
       4 │ │             Ordering::Greater => LineIndexOutOfBoundsError {
       5 │ │                 given: line_index,
       6 │ │                 max: self.last_line_index(),
       7 │ │             },
       8 │ │         }
         │ ╰─────────' `match` arms have incompatible types
         ·
       2 │               Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
         │                                 --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
       3 │               Ordering::Equal => Ok(self.source_span().end()),
         │                                  ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
       4 │               Ordering::Greater => LineIndexOutOfBoundsError {
         │ ╭──────────────────────────────────^
       5 │ │                 given: line_index,
       6 │ │                 max: self.last_line_index(),
       7 │ │             },
         │ ╰─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
         │
         = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
              found type `LineIndexOutOfBoundsError`
      

      …is now rendered as:

      error[E0308]: match arms have incompatible types
      
         ┌── codespan/src/file.rs:1:9 ───
         │
       1 │   ╭         match line_index.compare(self.last_line_index()) {
       2 │   │             Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
         │   │                               --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
       3 │   │             Ordering::Equal => Ok(self.source_span().end()),
         │   │                                ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
       4 │   │             Ordering::Greater => LineIndexOutOfBoundsError {
         │ ╭─│──────────────────────────────────^
       5 │ │ │                 given: line_index,
       6 │ │ │                 max: self.last_line_index(),
       7 │ │ │             },
         │ ╰─│─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
       8 │   │         }
         │   ╰─────────' `match` arms have incompatible types
         │
         = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
              found type `LineIndexOutOfBoundsError`
      

      </details>

    Open source →
  10. 0.9.1 22 Mar 2020
    Release notes

    Added

    • codespan_reporting::diagnostic::Diagnostic now implements Debug.

    Changed

    • Single-line labels are now rendered together, under the same source line.

      <details> <summary>Example</summary>

      For example:

         ┌── one_line.rs:3:5 ───
         │
       3 │     v.push(v.pop().unwrap());
         │     - first borrow later used by call
         ·
       3 │     v.push(v.pop().unwrap());
         │       ---- first mutable borrow occurs here
         ·
       3 │     v.push(v.pop().unwrap());
         │            ^ second mutable borrow occurs here
         │
      

      …is now rendered as:

         ┌── one_line.rs:3:5 ───
         │
       3 │     v.push(v.pop().unwrap());
         │     - first borrow later used by call
         │       ---- first mutable borrow occurs here
         │            ^ second mutable borrow occurs here
         │
      

      </details>

    Open source →
  11. 0.9.0 15 Mar 2020
    Release notes

    Added

    • The codespan_reporting::files module was added as a way to decouple codespan_reporting from codespan.
      • codespan_reporting::files::Files allows users to implement custom file databases that work with codespan_reporting. This should make it easier to integrate with libraries like Salsa, and also makes it less invasive to use codespan_reporting on existing projects.
      • codespan_reporting::files::SimpleFile is a simple implementation of codespan_reporting::files::Files where only a single file is needed.
      • codespan_reporting::files::SimpleFiles is a simple implementation of codespan_reporting::files::Files where multiple files are needed.

    Changed

    • The codespan_reporting::diagnostic module has been greatly revamped, making the builder API format more nicely with rustfmt, and allowing for multiple primary labels.
    • The output of codespan_reporting::term::emit was improved, with the following changes:
      • labels on consecutive lines no longer render breaks between them
      • source lines are rendered when there is only one line between labels
      • the inner gutter of code snippets is now aligned consistently
      • the outer gutter of consecutive code snippets are now aligned consistently
    • codespan_reporting::term::emit now takes writers as a trait object (rather than using static dispatch) in order to reduce coda bloat and improve compile times.
    • The field names in codespan_reporting::term::Chars were tweaked for consistency.

    Removed

    • codespan_reporting no longer depends on codespan. Note that codespan can still be used with codespan_reporting, as codespan::Files now implements codespan_reporting::files::Files.
    Open source →
  12. 0.8.0 24 Feb 2020

    Nothing published for this version

  13. 0.7.0 06 Jan 2020

    Nothing published for this version

  14. 0.6.0 18 Dec 2019

    Nothing published for this version

  15. 0.5.0 02 Oct 2019

    Nothing published for this version

  16. 0.4.1 25 Aug 2019

    Nothing published for this version

  17. 0.4.0 22 Aug 2019

    Nothing published for this version

  18. 0.3.0 30 Apr 2019

    Nothing published for this version

  19. 0.2.1 26 Feb 2019

    Nothing published for this version

  20. 0.2.0 11 Oct 2018
    Release notes
    Open source →
  21. 0.1.4 20 Aug 2018

    Nothing published for this version

  22. 0.1.3 18 Apr 2018

    Nothing published for this version

  23. 0.1.2 16 Apr 2018

    Nothing published for this version

  24. 0.1.1 16 Apr 2018

    Nothing published for this version

  25. 0.1.0 16 Apr 2018

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive