Skip to content
CAI
Software that uses CAICheck a score

dtolnay/anyhow

71.4

Strong · 29 September 2026

3.5k

lines of production code

Rust

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the \anyhow\ crate, a Rust library providing a trait-object based error handling type for idiomatic error management. It features a modular internal engine for error chaining, context attachment, and backtrace capture, along with macros like \ensure!\ and \bail!\ for convenient error creation. The library supports both standard and \no\_std\ environments and includes comprehensive testing for memory safety, drop semantics, and macro edge cases.

Features

Initial release of anyhow 1.0.0

This entry marks the initial commit and 1.0.0 release of the anyhow crate, introducing a trait-object based error type for idiomatic Rust error handling. The package includes the core library implementation, a build script for compiler feature probing, and comprehensive documentation in the README covering usage, no-std support, and comparisons to other error-handling libraries. The project is dual-licensed under MIT or Apache 2.0.

(repo-wide) · high confidence

Behavioural changes

Complete internal rewrite of the error handling engine

The internal implementation of the error handling engine has been completely rewritten to improve performance, reduce binary size, and modernize the codebase. This change introduces a new modular structure with dedicated files for backtrace capture (\backtrace.rs\), error chaining (\chain.rs\), context attachment (\context.rs\), and formatting (\fmt.rs\). It replaces the previous vtable-based error storage with a more efficient tagged-dispatch mechanism (\kind.rs\) and safe pointer wrappers (\ptr.rs\). The \ensure!\ macro has been significantly enhanced with a custom parser (\ensure.rs\) to support complex expressions and provide detailed debug output for comparison failures. Additionally, backtrace support is now integrated via the \error\_generic\_member\_access\ API on nightly compilers and the standard \std::backtrace\ on stable Rust 1.65+, ensuring consistent backtrace availability across versions.

src · high confidence

Test coverage

Added UI tests for \ensure!\ and \anyhow!\ macro edge cases; Added test crate with no\_std support and gitignore rules; Added test utilities for verifying Drop behavior; Comprehensive test suite for anyhow error handling.

Dependencies

Release 1.0.104 with Rust 1.68 requirement and syn 3 upgrade

The anyhow crate has been updated to version 1.0.104, raising the minimum required Rust compiler version to 1.68 and migrating the build to the 2021 edition. This release upgrades the syn dependency to version 3 and updates dev-dependencies to include thiserror v2 and trybuild v1.0.108. The crate now explicitly declares support for no-std environments via a dedicated feature flag and configures docs.rs to generate link-to-definition and macro-expansion documentation.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 71 → 71 (+0.3)
  • Rubric changed (rubric-2026.09.9 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 99 → 99 (+0.0)
  • Architecture 100 → 98 (-2.2)
  • Maturity 57 → 57 (+0.0)
  • Readiness 64 → 69 (+4.9)
  • Security 100 → 100 (+0.0)

New (5)

  • Inconsistent naming for error enrichment. 'Error.msg' suggests setting a message, while 'Context.context' and 'Context.with_context' suggest adding context. In the Anyhow library, 'context' and 'with_context' are the standard methods for adding context. 'Error.msg' is non-standard and potentially confusing as it might imply overwriting or setting a primary message rather than adding context. It breaks the 'context' naming convention used elsewhere.
  • Internal dispatch methods with confusingly similar names. '__dispatch_ensure' is a private/internal method (indicated by double underscore) but is exposed in the public API surface. The types 'BothDebug' and 'NotBothDebug' suggest conditional compilation or feature flags, but exposing these internal dispatch methods directly is inconsistent with typical Rust/Anyhow design where such internals are hidden. It creates noise and potential for misuse.
  • Inverted test pyramid
  • Low cohesion: Error (LCOM4 4) (src/lib.rs)
  • Redundant/Confusing naming for similar boxing operations. 'into_boxed_dyn_error' is the standard idiomatic name for consuming an error into a boxed trait object. 'reallocate_into_boxed_dyn_error_without_backtrace' is extremely verbose, uses 'reallocate' (implies memory management detail not usually exposed in high-level APIs), and explicitly mentions 'without_backtrace' which is a specific behavior variant. It is unclear if these are distinct performance optimizations or just poor naming for the same concept.

Changes since last survey

  • 1 commits — 1 feature/other, 0 fixes

By area

  • tests/ui — 1 commit

Notable commits

  • change: Update ui test suite to nightly-2026-09-29

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

dtolnay/anyhow was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 29 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 2cbb4e1bcbf8e7015f8d8b04a291c4c0597030b4 — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-c4983f2d4e5c.