439 Commits

Author SHA1 Message Date
Pavan Kumar Sunkara
40f429932b
Fix ci breaking due to new dependencies and rustc changes (backport to 0.6) (#162) 2024-03-29 09:39:51 +00:00
Freja Roberts
792c0844a6 fix: ci breaking due to new dependencies and rustc changes 2024-03-29 09:42:49 +01:00
Freja Roberts
701d05a9f6
Release 0.6.12 (#152)
Adds a hotfix missed in the last version, mistake by us as the previous
release happened on the same day as the bugfix.
2024-01-31 17:42:28 +01:00
LeoniePhiline
32826ab95e
fix(docs): fix two rustdoc::bare_urls warnings (#139)
Fixes #137
2023-12-30 01:50:02 +00:00
Jane Losare-Lusby
9caee14e36
Release 0.6.11 (#134)
rereleasing https://github.com/eyre-rs/eyre/pull/132 minus one breaking
change
2023-12-30 01:41:55 +00:00
Freja Roberts
53ec78d8c0
fix: ok_or_eyre not using track_caller (#140)
`ok_or_eyre` did not use `track_caller`, which meant the error location
was incorrect compared to the equivalent anyhow::context feature
2023-12-29 17:37:14 -08:00
Freja Roberts
770ac3fa14
Fix invalid drop impl call in Report::downcast (#143)
The context chain downcast called converted to the wrong inner type
which caused the wrong drop impl to be called.

The tests did not catch this because they had compatible drop
implementations due to matching type layout. Solved by swizzling the
fields of the chain test types to force incompatible layouts

Resolves: #141
2023-12-29 17:32:31 -08:00
Jane Losare-Lusby
32d84dcbac
Revert "Automatically convert to external errors w/ ensure! and bail!" (#133)
Reverts eyre-rs/eyre#95
2023-12-13 13:37:26 -08:00
nori li
d5cad7c2a1
Release 0.6.10 (#132)
Updates changelog and version references for release 0.6.10
2023-12-07 22:47:27 -08:00
LeoniePhiline
4e1f323d31
Extend Option with ok_or_eyre (#129)
Previously, a closure and macro invocation was
required to generate a static string error object
from an `Option::None`.

This change adds an extension trait, providing
the `ok_or_eyre` method on the `Option` type.

`Option::ok_or_eyre` accepts static error messages
and creates `Report` objects lazily in the `None` case.

Implements #125
2023-12-06 18:01:55 +01:00
Kyle Lacy
da84e8c624
Add eyre::Ok (#91)
This change introduces the function eyre::Ok(), a backport of the convenience function anyhow::Ok() which avoids a lengthy turbofish when producing an Ok(()).
2023-11-25 20:49:47 -08:00
James Baker
a795c97a2b
Automatically convert to external errors w/ ensure! and bail! (#95)
* Automatically convert to external errors

A pattern documented by thiserror is

```
pub enum MyError {
  ...

  #[error(transparent)]
  Other(#[from] anyhow::Error), // source and Display delegate to anyhow::Error
}
```

It'd be nice for this to work with ensure! but right now, that macro returns
an eyre error.

With this PR, the macro additionally runs an .into(). In the case that
the return type is an eyre error, obviously .into() will do nothing and
be compiled away. In the case that there is a from method, the wrapping
will occur. This enables eyre to be used for ergonomic 'implementation
detail error' in a thiserror using system which has contractual errors.

Since this conversion adds more flexibility to the result of these
macros, this could break code which relies on the narrowness to inform
type inference. If this is the case, update your code to specify the
result type you would like to use.

* Fix single-argument ensure test and allow dead code.

By adding the possibility for polymorphism from an eyre error, the
previous commit breaks a previous eyre test for single-argument
ensure!().

This change fixes that test and adds `allow(dead_code)` to the struct
used for the test for automatically converting to external errors.

---------

Co-authored-by: nori li <50680474+thenorili@users.noreply.github.com>
2023-11-24 22:04:47 -08:00
Akshay Narayan
0979ad7718
Add documentation on wrap_err vs wrap_err_with (#93)
Adds documentation on the difference in performance characteristics between  wrap_err vs wrap_err_with explored in Issue #126

---------

Co-authored-by: Jane Losare-Lusby <jlusby@yaah.dev>
2023-11-24 22:21:05 +00:00
Georg Brandl
ef778006cc macros: fix references to Error in docstrings 2023-11-22 01:45:31 -05:00
sharnoff
ec98ce3665 Add 1-argument ensure!($expr) 2023-11-21 14:34:49 -08:00
Jane Losare-Lusby
949e845777 remove deprecated lints as of 1.74 2023-11-21 14:28:07 -08:00
Jane Losare-Lusby
6d2e6e8df2 Release independent packages
color-spantrace@0.2.1
eyre@0.6.9

Generated by cargo-workspaces
2023-11-21 14:28:07 -08:00
Jane Losare-Lusby
a1c5dad686 manually apply cargo-release substitutions and also prep color-spantrace for publish 2023-11-21 14:28:07 -08:00
Jane Losare-Lusby
c31b47a530 Update changelog for 0.6.9 release 2023-11-21 14:28:07 -08:00
nori li
75511afd0e
Remove obsolete private_in_public lint in nightly and beta. (#113)
RFC 2145 is in beta now, deprecating the public_in_private lint.
https://rust-lang.github.io/rfcs/2145-type-privacy.html

public_in_private has been superceded by three new lints. The first two
are warn-by-default and the third is allow-by-default. See the excerpt
below for some details.

This change skips this lint in nightly and beta in favor of the new
warn-by-default lints.

This change revealed a bug in the toolchain config option for
color-spantrace -- it doesn't exist! The lint it was guarding was never
turned on. This adds a minimal build script to check for toolchain to
color-spantrace. Its functionality is tested in the eyre crate, which
seems sufficient to me.

After this change there are only two more build warnings for eyre and
color-spantrace, the future-incompat dependency warning and the more
serious filename collision.

<quote>
    Lint private_interfaces is reported when a type with visibility x is
    used in primary interface of an item with effective visibility y and
    x < y. This lint is warn-by-default.

    Lint private_bounds is reported when a type or trait with visibility
    x is used in secondary interface of an item with effective
    visibility y and x < y. This lint is warn-by-default.

    Lint unnameable_types is reported when effective visibility of a
    type is larger than module in which it can be named, either
    directly, or through reexports, or through trivial type aliases
    (type X = Y;, no generics on both sides). This lint is
    allow-by-default.

    Compatibility lint private_in_public is never reported and removed.
</quote>
2023-11-17 09:29:52 -08:00
Pavan Kumar Sunkara
fc4f006ba8
Merge pull request #117 from thenorili/pyo3-future-incompat
Update future-incompat pyo3 dependency
2023-11-10 10:55:46 +00:00
nori li
cadf826aba Update future-incompat pyo3 dependency
pyo3 v0.13.2 is tripping future-incompat. This change updates it to the newest 0.20.

pyo3 v0.16.0 renamed pvalue -> value.

The other future-incompat dependency, nom, is an indirect dependency through ansi-parser.

See issue 116
2023-11-10 10:52:24 +00:00
Pavan Kumar Sunkara
2422bcd089
Merge pull request #118 from thenorili/filename-collision
Avoid filename collision in the monorepo structure
2023-11-10 10:50:55 +00:00
nori li
1fc5c56683
Avoid filename collision in the monorepo structure
Warning: output filename collision appears in both stable and nightly builds.

It's slightly more impactful than just a warning. Running cargo +nightly
test, cargo test, cargo +nightly test in windows produces a linker error
where color-spantrace tries to use eyre's usage.exe, see error 2 below.
It's worked around pretty easily with cargo clean, but it's a problem
that might get worse as the monorepo effort expands!

This patch renames `usage.rs` to `CRATENAME-usage.rs`.

Issue #115
2023-11-09 22:31:42 -08:00
Jane Losare-Lusby
12479e96ef
Add contributing doc for eyre (#99)
* Add contributing doc for eyre

* update labels and remove unnecessary complexity
2023-11-07 14:02:24 -08:00
nori li
2ec1dff66d
Update documentation on no_std support. (#111)
no_std support was removed in 2020 with PR #29. This change updates the documentation to reflect that as suggested in PR #89. It still mentions no_std, which will hopefully keep it on our minds enough to check sometimes and see if the upstream problem has been resolved.

Co-authored-by: Jane Losare-Lusby <jlusby@yaah.dev>
2023-11-07 13:46:13 -08:00
nori li
7fefca5981
Add build script to check for nightly (#112)
The rustdoc_missing_doc_code_examples lint has been sending
warnings and causing CI issues due to being an unstable feature.

This change introduces a small build script that detects whether
the current toolchain is nightly and, if so, sets the config option
"nightly_features". This config option then sets the feature gate
for missing_doc_code_examples and turns on 'warn'.

It expands the existing code for parsing minor version
to parse the rest of the rust --version.

This change also introduces a toolchain test that uses
rust_version to double-check that the config option was enabled
IFF the nightly toolchain is being used.
2023-11-07 13:35:25 -08:00
Pavan Kumar Sunkara
0b24ae558f
Merge pull request #105 from eyre-rs/color-spantrace
Add color-spantrace to monorepo
2023-10-10 23:36:46 +01:00
Tei Leelo Roberts
e610c81607
Merge pull request #109 from eyre-rs/fix-color-spantrace-test
Fix color-spantrace test due to misinterpreted relative paths
2023-10-11 00:28:12 +02:00
Tei Roberts
0d7f941eb2 fix: unused imports under miri 2023-10-10 23:51:31 +02:00
Tei Roberts
0ad6355d9f chore: clarify file! behavior 2023-10-10 23:46:57 +02:00
Tei Roberts
e54e98f313 fix: color-spantrace does not work in miri sandbox 2023-10-10 23:43:32 +02:00
Tei Roberts
22b871bc0e fix: color-spantrace test due to misinterpreted relative paths 2023-10-10 23:40:34 +02:00
Pavan Kumar Sunkara
e42d667d15 Add color-spantrace to workspace 2023-10-03 21:18:59 +01:00
Pavan Kumar Sunkara
b40a66d493 Add 'color-spantrace/' from commit '1a52aac2b55a05efc64807f06b91414550805af8'
git-subtree-dir: color-spantrace
git-subtree-mainline: a443fd444ecfe8ac7f0d9a33b3f8e8d125eedbff
git-subtree-split: 1a52aac2b55a05efc64807f06b91414550805af8
2023-10-03 21:11:23 +01:00
Pavan Kumar Sunkara
a443fd444e
Move eyre code into a folder (#107) 2023-10-03 13:08:47 -07:00
Pavan Kumar Sunkara
044e2ae420
Merge pull request #104 from eyre-rs/monorepo
Create foundation for monorepo
2023-09-20 09:16:17 +01:00
Pavan Kumar Sunkara
be31cf59ff Create foundation for monorepo 2023-09-20 00:12:33 +01:00
Tei Leelo Roberts
9f4ecc497e
Fix miri validation errors through now stricter provenance (#103)
* fix(miri): box transmute and invalid references

The general causes for the miri invalidation is the prevelant use of
`Box` and its references to `ErrorImpl<()>`.

`mem::transmute` does not preserve the tag stack for transmuting the
boxes.

Additionally, having references to `ErrorImpl<()>` which has a different
layout than the allocation or `ErrorImpl<E>` for some unknown `E`. This
causes the new "untyped" reference to now have a provenance that
includes the size of E and thus is outside the provenance.

* fix(miri): downcast_mut using `&mut _ => *const _ => *mut`

* fix(miri): stub file reading

* fix(miri): don't construct temp references of shunk provenance

* ci: miri

* fix: `unsafe_op_in_unsafe_fn`

* chore!: bump MSRV

* chore: address PR comments

* fix: ci workflow names

* chore: raise msrv to 1.65 (addr2line)

* chore: revert distinctive CI names due to branch protection rules

The new names, such as `Test Platform Matrix` which do make it easier to
see which jobs failed, rather than msrv, test, and miri all being called
`Test Suite`, the in-place branch protection rules wait forever until
the now non-existent `Test Suite` passes
2023-09-19 13:02:20 -07:00
Tei Leelo Roberts
2d984da845
Cleanup internals (#101)
* fix: const_err is not a hard error

See: https://github.com/rust-lang/rust/issues/71800

* fix: lints

* fix: macro doctests

* fix: renamed lint

* fix: restore use of enum variant
2023-08-16 11:52:32 -07:00
Georg Brandl
ee2077e01d
lib: fix typos (#88)
* lib: fix typos

* lib: more typos
2023-08-11 19:07:49 -07:00
Joel Montes de Oca
c32a8d0b67
Grammer/typo (#85) 2022-08-19 14:11:29 -07:00
Tim Diekmann
dba523177e
Fix stacked borrows when dropping Error (#81) 2022-07-07 12:01:42 -07:00
Jane Lusby
64f88d7279
Add community discord to readme (#76) 2022-05-18 17:15:50 -07:00
Jane Lusby
1a52aac2b5
Merge pull request #19 from erickt/master
Add license files
2022-05-05 11:04:35 -07:00
Erick Tryzelaar
35031dc499 Add license files 2022-05-05 10:38:25 -07:00
Jane Lusby
b8f3892754
Release 0.6.8 (#74)
* Update changelog for new release

* Add recommendations on API stability

* (cargo-release) version 0.6.8
2022-04-04 10:31:50 -07:00
Philipp Oppermann
4f9661522b
Mark Report as #[must_use] (#73)
Not using the error type after construction is a common mistake. This can also easily happen with the provided macros, when using `eyre!` instead of `eyre::bail!`. By marking the type as `#[must_use]`, the compiler warns us in such cases.
2022-03-30 07:31:37 -07:00
William D. Jones
769e26e4ab
Add must-install feature, so that a non-default handler can be the on… (#52)
* Add must-install feature, so that a non-default handler can be the only handler consuming .text.

* Provide a better panic message if `must-install` feature is enabled.

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* Bump version because new feature was added.

* Convert must-install feature to auto-install to avoid negative features.

* Add ability to manually install DefaultHandler (for when auto-install is disabled).

* Ensure doctests pass when auto-install feature is disabled.

* Integration tests now succeed without auto-install feature.

* Add integration test for when auto-install feature is disabled.

* Add auto-install feature testing to CI.

* cargo fmt.

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
Co-authored-by: Jane Lusby <jlusby@yaah.dev>
2022-03-25 13:32:39 -07:00
Jane Lusby
f4ebce4518
release 0.6.7 (#71)
* update changelog

* (cargo-release) version 0.6.7
2022-02-24 21:10:36 -08:00