Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zkat/miette
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.0.0
Choose a base ref
...
head repository: zkat/miette
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Feb 7, 2024

  1. fix(tests): revert test-breaking changes of e5c7ae4 (#339)

    The commit e5c7ae4 seemed to (potentially erronously?) remove a number of
    spaces following the left `|` bar of some graphical report handler tests.
    That change had no effect on the `syntax_highlighter_on_real_file()`
    test, presumably because the trailing whitespace is removed by
    `strip_ansi_escapes::strip_str()`, but it did break the
    `triple_adjacent_highlight()` and `non_adjacent_hightlight()` tests.
    Restoring the spaces removed in e5c7ae4 fixes the failing tests on main.
    
    * fix(ci): move from minimal-versions to direct-minimal-versions
    TheLostLambda authored Feb 7, 2024
    Copy the full SHA
    6e829f8 View commit details
  2. Copy the full SHA
    c2f06f6 View commit details

Commits on Feb 8, 2024

  1. feat(source): derive common traits for NamedSource, SourceSpan, and S…

    …ourceOffset (#340)
    TheLostLambda authored Feb 8, 2024
    Copy the full SHA
    6f09250 View commit details

Commits on Feb 16, 2024

  1. feat(collection): add support for collection of labels (#341)

    Fixes: #315
    
    Allow errors to have a number of labels determined at runtime.
    An example of this is when the rust compiler labels all the arms of
    a `match` expression when one of them has an incompatible type
    
    To allow customization of the text for each label in a collection, add
    support for using LabeledSpan in collections instead of just regular
    spans
    Nahor authored Feb 16, 2024
    Copy the full SHA
    0306024 View commit details
  2. docs: update changelog

    zkat committed Feb 16, 2024
    Copy the full SHA
    dc77b0c View commit details
  3. chore: Release

    zkat committed Feb 16, 2024
    Copy the full SHA
    a18a644 View commit details

Commits on Feb 17, 2024

  1. fix(label-collections): Label collection fixes and cleanup (#343)

    * feat(collection): add label(collection) documentation to lib.rs
    
    * feat(collection): remove repeated formatting of label text
    
    Because of a typo, the label text was being formatted multiple times per
    label in a collection. With the fix, the text is formatted only once per
    collection
    
    * feat(collection): chain iterators rather than extend vector
    
    Since we are going to iterate anyway, instead of growing the label vector,
    chain the iterators. This should be more efficient.
    
    In some cases, this also remove a compilation warning about the label
    vector being unnecessarily mutable.
    
    * feat(collection): remove unnecessary `OptionalWrapper`
    
    - In a label collection, there is no need for a `None` label. One should
      just not add that label
    - Code wise it is also incorrect. The wrapper will be for a vector of
      spans, not for individual spans. It happens to work anyway, but this was
      not the intended use.
    Nahor authored Feb 17, 2024
    Copy the full SHA
    75fea09 View commit details

Commits on Feb 21, 2024

  1. fix(invalid span): skip the snippet when read_span fails (#347)

    Fixes: #219
    
    When a snippet couldn't be read (typically because the span didn't fit
    within the source code), it and the rest of the diagnostic were silently
    dropped, which was confusing to the developer.
    Now, in place of the snippet, print an error message with the name of
    the failed label and the error it triggered, then proceed with the rest
    of the diagnostic (footer, related, ...)
    Nahor authored Feb 21, 2024
    Copy the full SHA
    7d9dfc6 View commit details
  2. fix(redundant-import): fix a warning and CI failure in nightly (#348)

    Nahor authored Feb 21, 2024
    Copy the full SHA
    6ea86a2 View commit details

Commits on Feb 23, 2024

  1. feat(wasm): add feature "fancy-no-syscall" for wasm targets (#349)

    Fixes: #346
    Boshen authored Feb 23, 2024
    Copy the full SHA
    328bf37 View commit details
  2. docs: add severity example (#350)

    Co-authored-by: hzlinyiyu <hzlinyiyu@corp.netease.com>
    attila-lin and hzlinyiyu-netease authored Feb 23, 2024
    Copy the full SHA
    62cfd22 View commit details

Commits on Feb 28, 2024

  1. docs: use cargo readme to update (#351)

    attila-lin authored Feb 28, 2024
    Copy the full SHA
    22b29ee View commit details

Commits on Mar 7, 2024

  1. ci(doc consistency): check that lib.rs and README.md are consistent (#…

    Nahor authored Mar 7, 2024
    Copy the full SHA
    24a7bf4 View commit details
  2. docs: update changelog

    zkat committed Mar 7, 2024
    Copy the full SHA
    ff7baae View commit details
  3. chore: Release

    zkat committed Mar 7, 2024
    Copy the full SHA
    ca646f3 View commit details

Commits on Mar 27, 2024

  1. fix(graphical): fix nested error wrapping (#358)

    Fixes: #333
    TheLostLambda authored Mar 27, 2024
    Copy the full SHA
    3eabbce View commit details

Commits on Apr 3, 2024

  1. fix(docs): updated example image (fixes #111) (#270)

    TrapinchO authored Apr 3, 2024
    Copy the full SHA
    7b42b12 View commit details
  2. docs: fix up previous docs change a bit (#362)

    TrapinchO authored Apr 3, 2024
    Copy the full SHA
    97766e8 View commit details

Commits on Apr 13, 2024

  1. fix(clippy): Fix clippy lints in docs (#365)

    * Fix commented out code in lib.rs docs not found in README.md
    
    * Fix clippy lints in README.md and lib.rs
    willbush authored Apr 13, 2024
    Copy the full SHA
    ea4296d View commit details

Commits on May 1, 2024

  1. fix(docs): alt attribut for single-line-example.png (#372)

    * fix(docs): `alt` attribut for `single-line-example.png`
    
    The white line breaks in the `alt` attribute prevented the `single-line-example.png` image from being displayed.
    
    * Revert "fix(docs): `alt` attribut for `single-line-example.png`"
    
    This reverts commit 2e97d56.
    
    * fix: image link in `lib.rs` instead of `readme.md`
    
    * feat(docs): cargo make readme
    skarab42 authored May 1, 2024
    Copy the full SHA
    b82cc81 View commit details

Commits on Jun 11, 2024

  1. fix(color): setting NO_COLOR should not print ansi codes for non-term…

    …inals (#381)
    
    Fixes: #380
    Boshen authored Jun 11, 2024
    Copy the full SHA
    813232b View commit details

Commits on Jun 26, 2024

  1. fix(clippy): fix Rust v1.78.0 clippy warnings (#382)

    Boshen authored Jun 26, 2024
    Copy the full SHA
    e1026f7 View commit details
  2. perf(handlers): optimize string-buffer reallocations (#387)

    This improves `get_lines()` logic by using a string-buffer with a capacity hint.
    That avoids growing the buffer from zero each time, saving a bunch of reallocations.
    lucab authored Jun 26, 2024
    Copy the full SHA
    b8dfcda View commit details
  3. feat(SourceSpan): add impl From<InclusiveRange> (#385)

    This can be used to avoid awkward `start..(end + 1)` constructions,
    which will trigger the `clippy::range_plus_one` lint.
    
    I added a single impl for `InclusiveRange` rather than a blanket
    `impl<T: RangeBounds> From<T> for SourceSpan` for two reasons. The first
    is that the blanket impl would be a breaking change (because dependent
    crates may currently define a type `T: RangeBounds` and also have `impl
    From<T> for SourceSpan`). The second is that this would allow one-sided
    ranges (`..x`, `x..`). In order to support bounded-below ranges, we
    would need to change `SourceSpan` so that `length` may depend on the the
    specific `SourceCode` instance. That seems like an unlikely use case.
    olivia-fl authored Jun 26, 2024
    Copy the full SHA
    73da45b View commit details
  4. fix(perf): mark error constructors cold (#378)

    * refactor: mark error constructors cold
    
    * refactor: remove `Send + Sync` impl
    re-taro authored Jun 26, 2024
    Copy the full SHA
    9bbcf3c View commit details
  5. fix(handlers): Disable textwrap::smawk feature (#379)

    bugadani authored Jun 26, 2024
    Copy the full SHA
    edfdcb5 View commit details
  6. fix(report): conversion into Box<dyn Diagnostic> (#370)

    Fixes: #369
    
    Diagnostic impls are no longer reset to default when converting a
    `Report` into a `Box<dyn Diagnostic>`. Also prevented `Report` vtables
    and handlers from being kept around on the heap after conversion.
    TheLostLambda authored Jun 26, 2024
    Copy the full SHA
    bdd1d74 View commit details

Commits on Jul 11, 2024

  1. fix(graphical): Format entire link instead of just name (#389)

    jdygert-spok authored Jul 11, 2024
    Copy the full SHA
    bf5aa37 View commit details

Commits on Aug 6, 2024

  1. fix(clippy): fix clippy::doc_lazy_continuation lints (#395)

    * Fix `clippy::doc_lazy_continuation` lints
    
    * Fix `dead_code` warnings in tests.
    
    Protect code used in some tests based on features with feature
    checks.
    
    * Fix `clippy::needless_borrows_for_generic_args` lints
    
    * Remove a useless conversion
    
    * Remove a cfg_attr check for `track_caller`
    
    This shouldn't be needed here as the test is already ignored.
    waywardmonkeys authored Aug 6, 2024
    Copy the full SHA
    15beec4 View commit details

Commits on Aug 8, 2024

  1. fix(graphical): Handle invalid UTF-8 in source code (#393)

    * Handle invalid unicode in source
    
    * Fix build on 1.70
    Porges authored Aug 8, 2024
    Copy the full SHA
    d6b4558 View commit details

Commits on Sep 7, 2024

  1. feat(Report): add from_err() method to Report (#403)

    johnbchron authored Sep 7, 2024
    Copy the full SHA
    93d3bd1 View commit details

Commits on Sep 25, 2024

  1. deps: Bump terminal_size to 0.4.0 (#404)

    waywardmonkeys authored Sep 25, 2024
    Copy the full SHA
    21e9a70 View commit details
  2. fix(features): Use dep: syntax for dependencies in features. (#394)

    This prevents creating implicit features for them which can be
    confusing (and duplicates features).
    waywardmonkeys authored Sep 25, 2024
    Copy the full SHA
    789a04e View commit details
  3. docs: Fix typos (#398)

    waywardmonkeys authored Sep 25, 2024
    Copy the full SHA
    215f9aa View commit details
  4. docs: Fix some broken links and missing backticks. (#399)

    waywardmonkeys authored Sep 25, 2024
    Copy the full SHA
    d60c8f1 View commit details
  5. feat(Diagnostic): Implement Diagnostic for Infallible (#402)

    caass authored Sep 25, 2024
    Copy the full SHA
    f3fb4c1 View commit details

Commits on Sep 26, 2024

  1. fix(clippy): Fix needless_return lint. (#405)

    This happens when building with `--features fancy`.
    waywardmonkeys authored Sep 26, 2024
    Copy the full SHA
    5f441d0 View commit details

Commits on Nov 13, 2024

  1. docs(examples): add serde_json integration example (#407)

    Schniz authored Nov 13, 2024
    Copy the full SHA
    2902a23 View commit details

Commits on Nov 26, 2024

  1. docs: update changelog

    zkat committed Nov 26, 2024
    Copy the full SHA
    fe068f6 View commit details
  2. chore: Release

    zkat committed Nov 26, 2024
    Copy the full SHA
    01564e0 View commit details

Commits on Nov 27, 2024

  1. tests: Small refactor of doc tests (#396)

    Move use NamedSource a bit up, since now it looks like it is not
    imported.
    
    Co-authored-by: Marat Fattakhov <m.fattakhov@yadro.com>
    MFattakhov and Marat Fattakhov authored Nov 27, 2024
    Copy the full SHA
    68d47fa View commit details
  2. feat(graphical): Inherit source code to causes (#401)

    Porges authored Nov 27, 2024
    Copy the full SHA
    465e6b6 View commit details
  3. feat(report): Implement WrapError for Option (#409)

    Fixes: #408
    
    Implement `WrapError` for `Option<T>`. This is inline with `anyhow` that
    also implements `Context` for `Option<T>`.
    
    The implementation requires us to introduce a `DisplayError` internal
    only type, that creates an error from a type that only implements
    `Display` (`Report::from_adhoc` requires the type to also implement
    `Debug`, but `WrapError` only requires it to implement `Display`).
    
    For this I copied `MessageError` and adapted it to implement `Debug`
    using the underlying type's `Display` impl. This is a bit of a hack, but
    anyhow does [something similar][1].
    
    [1]: https://docs.rs/anyhow/latest/src/anyhow/wrapper.rs.html#34
    jalil-salame authored Nov 27, 2024
    Copy the full SHA
    7fae60f View commit details
  4. docs: update changelog

    zkat committed Nov 27, 2024
    Copy the full SHA
    0c46c0b View commit details
  5. chore: Release

    zkat committed Nov 27, 2024
    Copy the full SHA
    b2011f6 View commit details

Commits on Dec 8, 2024

  1. docs: fix broken link (#415)

    akiomik authored Dec 8, 2024
    Copy the full SHA
    c7eeada View commit details

Commits on Dec 22, 2024

  1. feat(graphical): support rendering related diagnostics as nested (#417)

    Fixes: #416
    elkowar authored Dec 22, 2024
    Copy the full SHA
    771a075 View commit details

Commits on Jan 14, 2025

  1. fix(graphical): prevent leading newline when no link/code (#418)

    unbyte authored Jan 14, 2025
    Copy the full SHA
    1e1938a View commit details
21 changes: 20 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@ jobs:
with:
toolchain: stable
components: rustfmt
- name: Install cargo-readme
run: cargo install cargo-readme
- name: Check doc consistency
shell: bash
run: diff -q README.md <(cargo readme)
|| { echo "::error::Update lib.rs then use cargo-readme to update README.md"; exit 1; }
- name: rustfmt
run: cargo fmt --all -- --check
- name: docs
@@ -49,6 +55,19 @@ jobs:
if: matrix.rust == '1.70.0'
run: cargo test --all --verbose --features ${{matrix.features}} no-format-args-capture

wasm:
name: Check Wasm build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Check wasm target
run: cargo check --target wasm32-unknown-unknown --features fancy-no-syscall

miri:
name: Miri
runs-on: ubuntu-latest
@@ -79,4 +98,4 @@ jobs:
with:
toolchain: nightly
- name: Run minimal version build
run: cargo build -Z minimal-versions --features fancy,no-format-args-capture
run: cargo build -Z direct-minimal-versions --features fancy,no-format-args-capture
67 changes: 67 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,72 @@
# `miette` Release Changelog

<a name="7.4.0"></a>
## 7.4.0 (2024-11-27)

### Features

* **graphical:** Inherit source code to causes (#401) ([465e6b6a](https://github.com/zkat/miette/commit/465e6b6ab627f8da34baa5f46441d944fb88186e))
* **report:** Implement `WrapError` for `Option` (#409) ([7fae60fd](https://github.com/zkat/miette/commit/7fae60fd8462f95cf3140c6a3b9eb06cb7953405))

<a name="7.3.0"></a>
## 7.3.0 (2024-11-26)

### Features

* **SourceSpan:** add impl From<InclusiveRange> (#385) ([73da45b6](https://github.com/zkat/miette/commit/73da45b65c965777a00ba64aa03a247c0e5241ca))
* **Report:** add `from_err()` method to `Report` (#403) ([93d3bd11](https://github.com/zkat/miette/commit/93d3bd118a072c35aa761f0ec74317166ec08113))
* **Diagnostic:** Implement `Diagnostic` for `Infallible` (#402) ([f3fb4c1e](https://github.com/zkat/miette/commit/f3fb4c1ecd196ce389cbd71139bb7e3b35474add))

### Performance

* **handlers:** optimize string-buffer reallocations (#387) ([b8dfcda4](https://github.com/zkat/miette/commit/b8dfcda4a8c10a14116ee275250356ac991dc7be))

### Bug Fixes

* **graphical:** fix nested error wrapping (#358) ([3eabbceb](https://github.com/zkat/miette/commit/3eabbcebf113d1d620a6a3f98e8a455414ed3042))
* **docs:** updated example image (fixes #111) (#270) ([7b42b12c](https://github.com/zkat/miette/commit/7b42b12c5f6316322ce79c59bcb9e99f5d49edb8))
* **clippy:** Fix clippy lints in docs (#365) ([ea4296da](https://github.com/zkat/miette/commit/ea4296dacec3b0e4762281d9d115c1bd69ecfac3))
* **docs:** `alt` attribut for `single-line-example.png` (#372) ([b82cc81b](https://github.com/zkat/miette/commit/b82cc81b8ea32a1cf1b4598ed5832bc8e3b0e161))
* **color:** setting NO_COLOR should not print ansi codes for non-terminals (#381) ([813232ba](https://github.com/zkat/miette/commit/813232ba7957ae09e4fb9d9416d821f4fd9da66d))
* **clippy:** fix Rust v1.78.0 clippy warnings (#382) ([e1026f75](https://github.com/zkat/miette/commit/e1026f75e0a5d19bbc8e468cb3f5292074543a97))
* **perf:** mark error constructors cold (#378) ([9bbcf3c6](https://github.com/zkat/miette/commit/9bbcf3c6017fa3455a7db714879816c1cfc511fd))
* **handlers:** Disable textwrap::smawk feature (#379) ([edfdcb52](https://github.com/zkat/miette/commit/edfdcb525ee30fc54747460ada621f13f0ed1996))
* **graphical:** Format entire link instead of just name (#389) ([bf5aa374](https://github.com/zkat/miette/commit/bf5aa3742fd664be3c93160b9c28c145b1ed8bc9))
* **clippy:** fix `clippy::doc_lazy_continuation` lints (#395) ([15beec43](https://github.com/zkat/miette/commit/15beec43303180b811d4c04d1a78775feb9b0905))
* **graphical:** Handle invalid UTF-8 in source code (#393) ([d6b45585](https://github.com/zkat/miette/commit/d6b4558502e82fa74e030ccb3c8040656590d7eb))
* **features:** Use `dep:` syntax for dependencies in features. (#394) ([789a04e3](https://github.com/zkat/miette/commit/789a04e30d041179b373b4eb8b340456534a3f0e))
* **clippy:** Fix `needless_return` lint. (#405) ([5f441d01](https://github.com/zkat/miette/commit/5f441d011560a091fe5d6a6cdb05f09acf622d36))

### Documentation

* **examples:** add serde_json integration example (#407) ([2902a233](https://github.com/zkat/miette/commit/2902a2337c2e36a5d8e0e54b007d6100cca0c9ff))

<a name="7.2.0"></a>
## 7.2.0 (2024-03-07)

### Features

* **wasm:** add feature "fancy-no-syscall" for wasm targets (#349) ([328bf379](https://github.com/zkat/miette/commit/328bf3792213fc0bed94e72a39acb722b65141dd))

### Bug Fixes

* **label-collections:** Label collection fixes and cleanup (#343) ([75fea093](https://github.com/zkat/miette/commit/75fea0935e495d0215518c80d32dd820910982e3))
* **invalid span:** skip the snippet when read_span fails (#347) ([7d9dfc6e](https://github.com/zkat/miette/commit/7d9dfc6e8e591f9606c3da55bd8465962358b20f))
* **redundant-import:** fix a warning and CI failure in nightly (#348) ([6ea86a22](https://github.com/zkat/miette/commit/6ea86a2248854acf88df345814b6c97d31b8b4d9))

<a name="7.1.0"></a>
## 7.1.0 (2024-02-16)

### Features

* **derive:** enable more boxed types to be #[diagnostic_source] (#338) ([c2f06f6c](https://github.com/zkat/miette/commit/c2f06f6cca15cbdd083dbff3d46b7729056ac6a4))
* **source:** derive common traits for NamedSource, SourceSpan, and SourceOffset (#340) ([6f09250c](https://github.com/zkat/miette/commit/6f09250cca14561f07fba899a8e6d3c0df14230e))
* **collection:** add support for collection of labels (#341) ([03060245](https://github.com/zkat/miette/commit/03060245d816a53a33209e6b7e1c3c42948e9962))

### Bug Fixes

* **tests:** revert test-breaking changes of e5c7ae4 (#339) ([6e829f8c](https://github.com/zkat/miette/commit/6e829f8c0ce2fc7bb2fc4041e6a6072f12db1f71))

<a name="7.0.0"></a>
## 7.0.0 (2024-02-05)

40 changes: 26 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "miette"
version = "7.0.0"
version = "7.4.0"
authors = ["Kat Marchán <kzm@zkat.tech>"]
description = "Fancy diagnostic reporting library and protocol for us mere mortals who aren't compiler hackers."
categories = ["rust-patterns"]
@@ -14,16 +14,17 @@ exclude = ["images/", "tests/", "miette-derive/"]

[dependencies]
thiserror = "1.0.56"
miette-derive = { path = "miette-derive", version = "=7.0.0", optional = true }
miette-derive = { path = "miette-derive", version = "=7.4.0", optional = true }
unicode-width = "0.1.11"
cfg-if = "1.0.0"

owo-colors = { version = "4.0.0", optional = true }
textwrap = { version = "0.16.0", optional = true }
textwrap = { version = "0.16.0", default-features = false, features = ["unicode-linebreak", "unicode-width"], optional = true }
supports-hyperlinks = { version = "3.0.0", optional = true }
supports-color = { version = "3.0.0", optional = true }
supports-unicode = { version = "3.0.0", optional = true }
backtrace = { version = "0.3.69", optional = true }
terminal_size = { version = "0.3.0", optional = true }
terminal_size = { version = "0.4.0", optional = true }
backtrace-ext = { version = "0.2.1", optional = true }
serde = { version = "1.0.196", features = ["derive"], optional = true }
syntect = { version = "5.1.0", optional = true }
@@ -36,30 +37,41 @@ futures = { version = "0.3", default-features = false }
indenter = "0.3.3"
rustversion = "1.0"
trybuild = { version = "1.0.89", features = ["diff"] }
syn = { version = "2.0", features = ["full"] }
syn = { version = "2.0.48", features = ["full"] }
regex = "1.10"
lazy_static = "1.4"

serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
strip-ansi-escapes = "0.2.0"

[features]
default = ["derive"]
derive = ["miette-derive"]
derive = ["dep:miette-derive"]
no-format-args-capture = []
fancy-base = [
"dep:owo-colors",
"dep:textwrap",
]
fancy-no-syscall = [
"fancy-base",
]
fancy-no-backtrace = [
"owo-colors",
"textwrap",
"terminal_size",
"supports-hyperlinks",
"supports-color",
"supports-unicode",
"fancy-base",
"dep:terminal_size",
"dep:supports-hyperlinks",
"dep:supports-color",
"dep:supports-unicode",
]
fancy = ["fancy-no-backtrace", "backtrace", "backtrace-ext"]
syntect-highlighter = ["fancy-no-backtrace", "syntect"]
fancy = ["fancy-no-backtrace", "dep:backtrace", "dep:backtrace-ext"]
syntect-highlighter = ["fancy-no-backtrace", "dep:syntect"]

[workspace]
members = ["miette-derive"]

[package.metadata.docs.rs]
all-features = true

[[example]]
name = "serde_json"
required-features = ["fancy"]
Loading