620 Commits

Author SHA1 Message Date
David Tolnay
2bbf85abee
Release 1.0.21 2019-11-17 14:55:25 -08:00
David Tolnay
00545d5c0e
Merge pull request #45 from dtolnay/chain
Provide DoubleEndedIterator and ExactSizeIterator for anyhow::Chain
2019-11-17 14:54:17 -08:00
David Tolnay
9ef3d2debe
Add chain iterator test 2019-11-17 14:49:16 -08:00
David Tolnay
7c8064f6a6
Implement ExactSizeIterator for Chain 2019-11-17 14:41:23 -08:00
David Tolnay
a2caba0748
Implement DoubleEndedIterator for Chain 2019-11-17 14:41:23 -08:00
David Tolnay
a8c199b37d
Move Chain implementation to chain.rs 2019-11-17 14:41:23 -08:00
David Tolnay
7246344a3e
Remove unneeded take in Chain implementation 2019-11-17 14:40:56 -08:00
David Tolnay
0dca03d315
Release 1.0.20 2019-11-15 21:36:23 -08:00
David Tolnay
a2b3fbd41a
Line up altdisplay expected strings on one line
Rustfmt does not like how these were previously formatted and insisted
on doing:

    const EXPECTED_ALTDISPLAY_G: &str = "\
                                         f failed: oh no!\
                                         ";

which is worse.
2019-11-15 21:34:44 -08:00
David Tolnay
87e85abfd8
Use instrs.json as file path in examples
The jsox file extension was intended to imply that there had been a
typo, but it ended up being distracting.
2019-11-15 21:33:01 -08:00
David Tolnay
437c691d16
Capitalize example error messages 2019-11-15 21:33:01 -08:00
David Tolnay
74954bdbd7
Merge pull request #42 from dtolnay/fmt
Add and document {:#} and {:#?} alt format representations
2019-11-15 21:32:53 -08:00
David Tolnay
c30a32bdda
Render alt display on one line with colons 2019-11-15 21:25:40 -08:00
David Tolnay
bba67262ed
Test the alt format representations 2019-11-15 20:59:57 -08:00
David Tolnay
42d02866ee
Document all the display representations 2019-11-15 20:50:30 -08:00
David Tolnay
7da2a83336
Move error formatting to fmt.rs 2019-11-15 20:44:02 -08:00
David Tolnay
b1c7c7afb1
Implement alternate display format {:#} 2019-11-15 20:44:02 -08:00
David Tolnay
cba8b1fb47
Implement alternate debug format {:#?} 2019-11-15 20:44:02 -08:00
David Tolnay
d324d628f3
Add Clone impl for anyhow::Chain 2019-11-15 20:44:02 -08:00
David Tolnay
373930df3d
Update stack backtrace disabled notice 2019-11-15 20:44:02 -08:00
David Tolnay
68897dfeb2
Capitalize stack backtrace heading 2019-11-15 20:44:02 -08:00
David Tolnay
4e2dd07c8d
Remove redundant backtrace trailing newline 2019-11-15 20:44:02 -08:00
David Tolnay
04b11c5cf4
Add Error::msg constructor to simplify map_err combinators 2019-11-15 13:48:09 -08:00
David Tolnay
360c93a1fd
Release 1.0.19 2019-11-02 13:25:50 -07:00
David Tolnay
d6959993fa
Merge pull request #38 from dtolnay/format_err
Provide format_err macro
2019-11-02 13:25:25 -07:00
David Tolnay
bd0733fe02
Provide format_err macro 2019-11-02 13:22:06 -07:00
David Tolnay
791754e3c0
Add brief comparison with thiserror 2019-10-28 23:53:00 -07:00
David Tolnay
afa1a47f76
Release 1.0.18 2019-10-28 07:59:33 -07:00
David Tolnay
f721eec438
Remove fehler link
The Anyhow implementation has changed a lot and is now quite different
from der Fehler.
2019-10-28 07:57:44 -07:00
David Tolnay
8fcd8d015a
Merge pull request #34 from dtolnay/context
Support downcasting errors with context to C *or* E
2019-10-27 21:40:59 -07:00
David Tolnay
61ad446799
Document the interaction of context and downcast 2019-10-27 21:33:58 -07:00
David Tolnay
b9d69af29e
Add tests for downcasting context 2019-10-27 21:33:57 -07:00
David Tolnay
b119f4997f
Remove unneeded object_is vtable method 2019-10-27 21:33:57 -07:00
David Tolnay
fa36bac5b5
Rename the ErrorImpl tail to _object
Avoids _error.error repetition when manipulation ErrorImpl<ContextError>,
and works well with object_ref / object_mut naming in the vtable.
2019-10-27 21:33:57 -07:00
David Tolnay
6a25ac3692
Support downcasting ContextError<C, Error> to C and cause 2019-10-27 21:33:57 -07:00
David Tolnay
d84def42ce
Support downcasting ContextError<C, E> to C and E 2019-10-27 21:33:57 -07:00
David Tolnay
5d1e685152
Move downcasting into vtable 2019-10-27 21:21:01 -07:00
David Tolnay
5e04e776ef
Disable needless_doctest_main lint 2019-10-27 21:20:38 -07:00
David Tolnay
b2f0f456f5
Atomic flag type for use in Drop tests 2019-10-27 21:20:03 -07:00
David Tolnay
e674ddcf79
Put context first in the Debug impl for ContextError 2019-10-27 16:40:28 -07:00
David Tolnay
45e6fc6bfd
Expand ContextError vtable to prepare for extending downcast support 2019-10-27 16:16:56 -07:00
David Tolnay
b261a64e48
Specify types where the manual vtable relies on them 2019-10-27 16:07:30 -07:00
David Tolnay
a2846fd345
Eliminate backtrace_if_absent in Error::context
This avoids stepping through the list of causes when adding context to
the anyhow::Error type which is known to already hold a backtrace.

Reduces the release-mode time of the following loop from 4 seconds to 4
milliseconds.

    let mut err = anyhow!("...");
    for _ in 0..25000 {
        err = err.context("...");
    }
2019-10-27 16:06:48 -07:00
David Tolnay
8885e93ca6
Merge pull request #33 from dtolnay/typeid
Move TypeId out of the Box allocation
2019-10-27 15:32:28 -07:00
David Tolnay
7b9b07ea8a
Add test of unsuccessful downcasts 2019-10-27 15:26:35 -07:00
David Tolnay
4ec3791086
Move TypeId out of the Box allocation 2019-10-27 15:24:22 -07:00
David Tolnay
30c2eab25f
Move ContextError to error.rs in preparation for refactor 2019-10-27 15:00:04 -07:00
David Tolnay
9f38495af3
Swap ContextError type parameters to match type name 2019-10-27 14:56:45 -07:00
David Tolnay
def64cbb96 Match actual capitalization in Context example output 2019-10-21 19:51:17 -07:00
David Tolnay
810f73e42c
Release 1.0.17 2019-10-21 11:25:23 -07:00