340 Commits

Author SHA1 Message Date
David Tolnay
03ef684ba1
Rename source to object in vtable
Since these function pointers have nothing to do with Error::source.
2019-10-07 23:16:10 -07:00
David Tolnay
8220e0a3c4
Merge pull request #5 from johnschug/master
Fix potential UB by removing reliance on trait object layout
2019-10-07 23:12:43 -07:00
John Schug
92bfd6f366 Fix potential UB by removing reliance on trait object layout
Adds a raw vtable object (similar to `RawWakerVTable`) that is manually
created and has methods to dynamically cast to `dyn StdError`.
2019-10-07 22:58:35 -07:00
David Tolnay
8571666481 Release 1.0.1 2019-10-07 13:48:31 -07:00
David Tolnay
28908f4b21 Touch up ensure macro documentation 2019-10-07 13:47:06 -07:00
David Tolnay
c5e1ca0e04 Remove unneeded parens in ensure macro 2019-10-07 13:44:13 -07:00
David Tolnay
dd1876cb32 Move macro tests to tests directory 2019-10-07 13:43:53 -07:00
David Tolnay
541b275508 Merge pull request 2 from EmbarkStudios/bail-single-str 2019-10-07 13:38:04 -07:00
David Tolnay
abcb255ebb
Merge pull request #4 from EmbarkStudios/ensure
Add ensure macro
2019-10-07 13:25:49 -07:00
David Tolnay
dcb6b794cc
Merge pull request #3 from dtolnay/literal
Accept string literal in bail macro
2019-10-07 13:21:37 -07:00
Johan Andersson
a1306a2323 Add ensure macro.
Fix #1.
2019-10-07 22:19:37 +02:00
David Tolnay
08b3d5d42b Accept string literal in bail macro 2019-10-07 13:16:30 -07:00
Johan Andersson
9c6fe3225a Fix bail with single str parameter.
This was resulting in a missing From conversion, so now just use the anyhow macro also for single parameter bail.
Also added small test to verify that that it compiles.
2019-10-07 22:05:20 +02:00
David Tolnay
6fa503dff5
Show supported compiler version in readme 2019-10-07 08:54:05 -07:00
David Tolnay
0193d0cc84
Add comparison to failure crate 2019-10-07 08:25:15 -07:00
David Tolnay
4920eb98b2
Raise minimum supported rustc version to 1.32
For the $(...)? specifier in macros.
2019-10-07 08:00:11 -07:00
David Tolnay
3d65a7849c
Release 1.0.0 2019-10-07 07:55:24 -07:00
David Tolnay
b0c8c75766
Omit '0:' if only one cause 2019-10-06 17:02:43 -04:00
David Tolnay
ad275d587f
Indent causes in Debug representation with spaces 2019-10-06 17:00:48 -04:00
David Tolnay
a97f8dc3eb
Capitalize lines of Debug representation 2019-10-06 16:59:51 -04:00
David Tolnay
feb9f33dde
Add example to Chain iterator 2019-10-06 16:13:19 -04:00
David Tolnay
d159b79a63
Add example of Error::chain 2019-10-06 16:10:37 -04:00
David Tolnay
896dd7abb8
Explain the purpose of Error::context 2019-10-06 16:06:19 -04:00
David Tolnay
1ea72bbde3
Add Error::root_cause accessor 2019-10-06 15:55:02 -04:00
David Tolnay
0c21b7a336
Add example to Error::downcast_ref 2019-10-06 15:50:22 -04:00
David Tolnay
8235aa94b3
Call out that returning anyhow::Result from main is ok 2019-10-06 15:45:56 -04:00
David Tolnay
bab03c1840
Document Context trait with example 2019-10-06 15:42:56 -04:00
David Tolnay
a65335170e
Document anyhow macro with example 2019-10-06 15:34:01 -04:00
David Tolnay
5bbb899cc6
Document bail macro with examples 2019-10-06 13:20:32 -04:00
David Tolnay
511886e48f
Support string interpolation in bail macro 2019-10-06 13:06:08 -04:00
David Tolnay
d06569dfed
Document anyhow::Result with example 2019-10-06 13:03:01 -04:00
David Tolnay
55181d5bc4
Set html_root_url 2019-10-06 12:59:59 -04:00
David Tolnay
17cd390308
Simplify handling of trailing commas 2019-10-06 12:59:11 -04:00
David Tolnay
efce155177
Include example of anyhow! macro 2019-10-06 12:57:14 -04:00
David Tolnay
c0db22416a
No longer identical 2019-10-06 12:57:07 -04:00
David Tolnay
11a95ca5b0
Link to err-derive crate 2019-10-06 12:57:06 -04:00
David Tolnay
63cd824139
Unconditionally store Option<Backtrace> 2019-10-06 02:08:32 -04:00
David Tolnay
a2d7e2fd0c
Remove use of attributes on function parameters
This has been stabilized in nightly but has not yet reached a stable
channel release yet.
2019-10-06 02:06:18 -04:00
David Tolnay
6d162476c6
Make doc tests compilable 2019-10-06 02:00:02 -04:00
David Tolnay
ecdfdc25f7
Copy readme to crate level doc 2019-10-06 02:00:00 -04:00
David Tolnay
97314ac5a9
Remove a layer of wrapping from debug mode backtraces 2019-10-06 01:59:59 -04:00
David Tolnay
c207f6a102
Include more information in readme 2019-10-06 01:59:58 -04:00
David Tolnay
61e587f58f
Link to Context trait from Error::context method 2019-10-06 00:59:49 -04:00
David Tolnay
4119806663
Mention env var in Error::backtrace documentation 2019-10-06 00:59:48 -04:00
David Tolnay
6ad6457801
Make new_adhoc unambiguously private 2019-10-06 00:59:47 -04:00
David Tolnay
a8ce6e44ec
Touch up documentation on Error struct 2019-10-06 00:59:45 -04:00
David Tolnay
73c7283505
Remove as_dyn_error methods from Error
The underlying `dyn StdError + Send + Sync + 'static` is still available
through Deref and DerefMut.
2019-10-06 00:59:44 -04:00
David Tolnay
508f881ca4
Add one sentence project summary 2019-10-05 23:38:42 -04:00
David Tolnay
cc403d7559
Test on older compilers in Travis 2019-10-05 23:22:36 -04:00
David Tolnay
270ea5e7d5
Detect nightly and only expose backtrace if available 2019-10-05 23:20:51 -04:00