Skip to content

Commit c966f2b

Browse files
committed
added hidden nonexaustive variant
fixes rust-lang-deprecated#182
1 parent c723ff7 commit c966f2b

File tree

12 files changed

+1105
-119
lines changed

12 files changed

+1105
-119
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ env:
3535
global:
3636
- secure: ncxJbvJM1vCZfcEftjsFKJMxxhKLgWKaR8Go9AMo0VB5fB2XVW/6NYO5bQEEYpOf1Nc/+2FbI2+Dkz0S/mJpUcNSfBgablCHgwU2sHse7KsoaqfHj2mf1E3exjzSHoP96hPGicC5zAjSXFjCgJPOUSGqqRaJ7z5AsJLhJT6LuK7QpvwPBZzklUN8T+n1sVmws8TNmRIbaniq/q6wYHANHcy6Dl59dx4sKwniUGiZdUhCiddVpoxbECSxc0A8mN2pk7/aW+WGxK3goBs5ZF7+JXF318F62pDcXQmR5CX6WdpenIcJ25g1Vg1WhQ4Ifpe17CN0bfxV8ShuzrQUThCDMffZCo9XySBtODdEowwK1UIpjnFLfIxjOs45Cd8o3tM2j0CfvtnjOz6BCdUU0qiwNPPNx0wFkx3ZiOfSh+FhBhvyPM12HN2tdN0esgVBItFmEci+sSIIXqjVL6DNiu5zTjbu0bs6COwlUWdmL6vmsZtq5tl7Cno9+C3szxRVAkShGydd04l9NYjqNEzTa1EPG50OsnVRKGdRiFzSxhc3BWExNKvcQ4v867t6/PpPkW6s4oXmYI3+De+8O7ExWc6a4alcrDXKlMs5fCb5Pcd4Ju9kowcjkoJo5yf2wW3Ox5R8SJpaEEpvyhx5O/qtIxjhHNzeo8Wsr/6gdNDv20r91TI=
3737
- TRAVIS_CARGO_NIGHTLY_FEATURE=""
38+
- RUSTFLAGS="-D warnings"
3839
matrix:
3940
- FEATURES=--features=backtrace
4041
- FEATURES=--no-default-features

CHANGELOG.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
# Unreleased
2-
3-
- [Add a new method for `Error`: `chain_err`.](https://github.com/brson/error-chain/pull/141)
4-
- [Allow `chain_err` to be used on `Option<T>`](https://github.com/brson/error-chain/pull/156)
5-
- [Add support for creating an error chain on boxed trait errors (`Box<Error>`)](https://github.com/brson/error-chain/pull/156)
1+
# 0.11.0-rc.2
2+
3+
- [Make `ErrorChainIter`'s field private](https://github.com/rust-lang-nursery/error-chain/issues/178)
4+
- [Rename `ErrorChainIter` to `Iter`](https://github.com/rust-lang-nursery/error-chain/issues/168)
5+
- [Implement `Debug` for `ErrorChainIter`](https://github.com/rust-lang-nursery/error-chain/issues/169)
6+
- [Rename `ChainedError::display` to `display_chain`](https://github.com/rust-lang-nursery/error-chain/issues/180)
7+
- [Add a new method for `Error`: `chain_err`.](https://github.com/rust-lang-nursery/error-chain/pull/141)
8+
- [Allow `chain_err` to be used on `Option<T>`](https://github.com/rust-lang-nursery/error-chain/pull/156)
9+
- [Add support for creating an error chain on boxed trait errors (`Box<Error>`)](https://github.com/rust-lang-nursery/error-chain/pull/156)
10+
- [Remove lint for unused doc comment.](https://github.com/rust-lang-nursery/error-chain/pull/199)
11+
- [Generated `ErrorKind` enums are now nonexaustive](https://github.com/rust-lang-nursery/error-chain/pull/193)
612

713
# 0.10.0
814

9-
- [Add a new constructor for `Error`: `with_chain`.](https://github.com/brson/error-chain/pull/126)
10-
- [Add the `ensure!` macro.](https://github.com/brson/error-chain/pull/135)
15+
- [Add a new constructor for `Error`: `with_chain`.](https://github.com/rust-lang-nursery/error-chain/pull/126)
16+
- [Add the `ensure!` macro.](https://github.com/rust-lang-nursery/error-chain/pull/135)
1117

1218
# 0.9.0
1319

14-
- Revert [Add a `Sync` bound to errors](https://github.com/brson/error-chain/pull/110)
20+
- Revert [Add a `Sync` bound to errors](https://github.com/rust-lang-nursery/error-chain/pull/110)
1521

1622
# 0.8.1
1723

18-
- Add crates.io categorie.
24+
- Add crates.io category.
1925

2026
# 0.8.0
2127

22-
- [Add a `Sync` bound to errors](https://github.com/brson/error-chain/pull/110)
23-
- [Add `ChainedError::display` to format error chains](https://github.com/brson/error-chain/pull/113)
28+
- [Add a `Sync` bound to errors](https://github.com/rust-lang-nursery/error-chain/pull/110)
29+
- [Add `ChainedError::display` to format error chains](https://github.com/rust-lang-nursery/error-chain/pull/113)
2430

2531
# 0.7.2
2632

@@ -30,11 +36,11 @@
3036

3137
# 0.7.1
3238

33-
- [Add the `bail!` macro](https://github.com/brson/error-chain/pull/76)
39+
- [Add the `bail!` macro](https://github.com/rust-lang-nursery/error-chain/pull/76)
3440

3541
# 0.7.0
3642

37-
- [Rollback several design changes to fix regressions](https://github.com/brson/error-chain/pull/75)
43+
- [Rollback several design changes to fix regressions](https://github.com/rust-lang-nursery/error-chain/pull/75)
3844
- New `Variant(Error) #[attrs]` for `links` and `foreign_links`.
3945
- Hide implementation details from the doc.
4046
- Always generate `Error::backtrace`.
@@ -64,41 +70,42 @@
6470

6571
# 0.5.0
6672

67-
- [Only generate backtraces with RUST_BACKTRACE set](https://github.com/brson/error-chain/pull/27)
68-
- [Fixup matching, disallow repeating "types" section](https://github.com/brson/error-chain/pull/26)
69-
- [Fix tests on stable/beta](https://github.com/brson/error-chain/pull/28)
70-
- [Only deploy docs when tagged](https://github.com/brson/error-chain/pull/30)
73+
- [Only generate backtraces with RUST_BACKTRACE set](https://github.com/rust-lang-nursery/error-chain/pull/27)
74+
- [Fixup matching, disallow repeating "types" section](https://github.com/rust-lang-nursery/error-chain/pull/26)
75+
- [Fix tests on stable/beta](https://github.com/rust-lang-nursery/error-chain/pull/28)
76+
- [Only deploy docs when tagged](https://github.com/rust-lang-nursery/error-chain/pull/30)
7177

7278
Contributors: benaryorg, Brian Anderson, Georg Brandl
7379

7480
# 0.4.2
7581

76-
- [Fix the resolution of the ErrorKind description method](https://github.com/brson/error-chain/pull/24)
82+
- [Fix the resolution of the ErrorKind description method](https://github.com/rust-lang-nursery/error-chain/pull/24)
7783

7884
Contributors: Brian Anderson
7985

8086
# 0.4.1 (yanked)
8187

82-
- [Fix a problem with resolving methods of the standard Error type](https://github.com/brson/error-chain/pull/22)
88+
- [Fix a problem with resolving methods of the standard Error type](https://github.com/rust-lang-nursery/error-chain/pull/22)
8389

8490
Contributors: Brian Anderson
8591

8692
# 0.4.0 (yanked)
8793

88-
- [Remove the foreign link description and forward to the foreign error](https://github.com/brson/error-chain/pull/19)
89-
- [Allow missing sections](https://github.com/brson/error-chain/pull/17)
94+
- [Remove the foreign link description and forward to the foreign error](https://github.com/rust-lang-nursery/error-chain/pull/19)
95+
- [Allow missing sections](https://github.com/rust-lang-nursery/error-chain/pull/17)
9096

9197
Contributors: Brian Anderson, Taylor Cramer
9298

9399
# 0.3.0
94100

95-
- [Forward Display implementation for foreign errors](https://github.com/brson/error-chain/pull/13)
101+
- [Forward Display implementation for foreign errors](https://github.com/rust-lang-nursery/error-chain/pull/13)
96102

97103
Contributors: Brian Anderson, Taylor Cramer
98104

99105
# 0.2.2
100106

101-
- [Don't require `types` section in macro invocation](https://github.com/brson/error-chain/pull/8)
102-
- [Add "quick start" to README](https://github.com/brson/error-chain/pull/9)
107+
- [Don't require `types` section in macro invocation](https://github.com/rust-lang-nursery/error-chain/pull/8)
108+
- [Add "quick start" to README](https://github.com/rust-lang-nursery/error-chain/pull/9)
103109

104110
Contributors: Brian Anderson, Jake Shadle, Nate Mara
111+

CHANGELOG.md.orig

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# 0.11.0-rc.2
2+
3+
<<<<<<< HEAD
4+
- [Make `ErrorChainIter`'s field private](https://github.com/brson/error-chain/issues/178)
5+
- [Rename `ErrorChainIter` to `Iter`](https://github.com/brson/error-chain/issues/168)
6+
- [Implement `Debug` for `ErrorChainIter`](https://github.com/brson/error-chain/issues/169)
7+
- [Rename `ChainedError::display` to `display_chain`](https://github.com/brson/error-chain/issues/180)
8+
- [Add a new method for `Error`: `chain_err`.](https://github.com/brson/error-chain/pull/141)
9+
- [Allow `chain_err` to be used on `Option<T>`](https://github.com/brson/error-chain/pull/156)
10+
- [Add support for creating an error chain on boxed trait errors (`Box<Error>`)](https://github.com/brson/error-chain/pull/156)
11+
- [Remove lint for unused doc comment.](https://github.com/brson/error-chain/pull/199)
12+
- [Generated `ErrorKind` enums are now nonexaustive](https://github.com/brson/error-chain/pull/193)
13+
=======
14+
- [Make `ErrorChainIter`'s field private](https://github.com/rust-lang-nursery/error-chain/issues/178)
15+
- [Rename `ErrorChainIter` to `Iter`](https://github.com/rust-lang-nursery/error-chain/issues/168)
16+
- [Implement `Debug` for `ErrorChainIter`](https://github.com/rust-lang-nursery/error-chain/issues/169)
17+
- [Rename `ChainedError::display` to `display_chain`](https://github.com/rust-lang-nursery/error-chain/issues/180)
18+
- [Add a new method for `Error`: `chain_err`.](https://github.com/rust-lang-nursery/error-chain/pull/141)
19+
- [Allow `chain_err` to be used on `Option<T>`](https://github.com/rust-lang-nursery/error-chain/pull/156)
20+
- [Add support for creating an error chain on boxed trait errors (`Box<Error>`)](https://github.com/rust-lang-nursery/error-chain/pull/156)
21+
- [Remove lint for unused doc comment.](https://github.com/rust-lang-nursery/error-chain/pull/199)
22+
>>>>>>> 7feb96d... Fix broken links after move to rust-lang-nursery (#205)
23+
24+
# 0.10.0
25+
26+
- [Add a new constructor for `Error`: `with_chain`.](https://github.com/rust-lang-nursery/error-chain/pull/126)
27+
- [Add the `ensure!` macro.](https://github.com/rust-lang-nursery/error-chain/pull/135)
28+
29+
# 0.9.0
30+
31+
- Revert [Add a `Sync` bound to errors](https://github.com/rust-lang-nursery/error-chain/pull/110)
32+
33+
# 0.8.1
34+
35+
- Add crates.io category.
36+
37+
# 0.8.0
38+
39+
- [Add a `Sync` bound to errors](https://github.com/rust-lang-nursery/error-chain/pull/110)
40+
- [Add `ChainedError::display` to format error chains](https://github.com/rust-lang-nursery/error-chain/pull/113)
41+
42+
# 0.7.2
43+
44+
- Add `quick_main!` (#88).
45+
- `allow(unused)` for the `Result` wrapper.
46+
- Minimum rust version supported is now 1.10 on some conditions (#103).
47+
48+
# 0.7.1
49+
50+
- [Add the `bail!` macro](https://github.com/rust-lang-nursery/error-chain/pull/76)
51+
52+
# 0.7.0
53+
54+
- [Rollback several design changes to fix regressions](https://github.com/rust-lang-nursery/error-chain/pull/75)
55+
- New `Variant(Error) #[attrs]` for `links` and `foreign_links`.
56+
- Hide implementation details from the doc.
57+
- Always generate `Error::backtrace`.
58+
59+
# 0.6.2
60+
61+
- Allow dead code.
62+
63+
# 0.6.1
64+
65+
- Fix wrong trait constraint in ResultExt implementation (#66).
66+
67+
# 0.6.0
68+
69+
- Conditional compilation for error variants.
70+
- Backtrace generation is now a feature.
71+
- More standard trait implementations for extra convenience.
72+
- Remove ChainErr.
73+
- Remove need to specify `ErrorKind` in `links {}`.
74+
- Add ResultExt trait.
75+
- Error.1 is a struct instead of a tuple.
76+
- Error is now a struct.
77+
- The declarations order is more flexible.
78+
- Way better error reporting when there is a syntax error in the macro call.
79+
- `Result` generation can be disabled.
80+
- At most one declaration of each type can be present.
81+
82+
# 0.5.0
83+
84+
- [Only generate backtraces with RUST_BACKTRACE set](https://github.com/rust-lang-nursery/error-chain/pull/27)
85+
- [Fixup matching, disallow repeating "types" section](https://github.com/rust-lang-nursery/error-chain/pull/26)
86+
- [Fix tests on stable/beta](https://github.com/rust-lang-nursery/error-chain/pull/28)
87+
- [Only deploy docs when tagged](https://github.com/rust-lang-nursery/error-chain/pull/30)
88+
89+
Contributors: benaryorg, Brian Anderson, Georg Brandl
90+
91+
# 0.4.2
92+
93+
- [Fix the resolution of the ErrorKind description method](https://github.com/rust-lang-nursery/error-chain/pull/24)
94+
95+
Contributors: Brian Anderson
96+
97+
# 0.4.1 (yanked)
98+
99+
- [Fix a problem with resolving methods of the standard Error type](https://github.com/rust-lang-nursery/error-chain/pull/22)
100+
101+
Contributors: Brian Anderson
102+
103+
# 0.4.0 (yanked)
104+
105+
- [Remove the foreign link description and forward to the foreign error](https://github.com/rust-lang-nursery/error-chain/pull/19)
106+
- [Allow missing sections](https://github.com/rust-lang-nursery/error-chain/pull/17)
107+
108+
Contributors: Brian Anderson, Taylor Cramer
109+
110+
# 0.3.0
111+
112+
- [Forward Display implementation for foreign errors](https://github.com/rust-lang-nursery/error-chain/pull/13)
113+
114+
Contributors: Brian Anderson, Taylor Cramer
115+
116+
# 0.2.2
117+
118+
- [Don't require `types` section in macro invocation](https://github.com/rust-lang-nursery/error-chain/pull/8)
119+
- [Add "quick start" to README](https://github.com/rust-lang-nursery/error-chain/pull/9)
120+
121+
Contributors: Brian Anderson, Jake Shadle, Nate Mara

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
[package]
2-
32
name = "error-chain"
4-
version = "0.10.1-pre"
3+
version = "0.11.0-rc.2" # remember to update html_root_url
54
authors = [ "Brian Anderson <[email protected]>",
65
"Paul Colomiets <[email protected]>",
76
"Colin Kiegel <[email protected]>",
87
"Yamakaky <[email protected]>"]
98
description = "Yet another error boilerplate library."
9+
keywords = ["error"]
1010
categories = ["rust-patterns"]
1111

1212
documentation = "https://docs.rs/error-chain"
13-
homepage = "https://github.com/brson/error-chain"
14-
repository = "https://github.com/brson/error-chain"
13+
repository = "https://github.com/rust-lang-nursery/error-chain"
14+
readme = "README.md"
1515

1616
license = "MIT/Apache-2.0"
1717

1818
[badges]
19-
travis-ci = { repository = "brson/error-chain" }
19+
travis-ci = { repository = "rust-lang-nursery/error-chain" }
2020

2121
[features]
2222
default = ["backtrace", "example_generated"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# error-chain - Consistent error handling for Rust
22

3-
[![Build Status](https://api.travis-ci.org/brson/error-chain.svg?branch=master)](https://travis-ci.org/brson/error-chain)
3+
[![Build Status](https://api.travis-ci.org/rust-lang-nursery/error-chain.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/error-chain)
44
[![Latest Version](https://img.shields.io/crates/v/error-chain.svg)](https://crates.io/crates/error-chain)
5-
[![License](https://img.shields.io/github/license/brson/error-chain.svg)](https://github.com/brson/error-chain)
5+
[![License](https://img.shields.io/github/license/rust-lang-nursery/error-chain.svg)](https://github.com/rust-lang-nursery/error-chain)
66

77
`error-chain` makes it easy to take full advantage of Rust's error
88
handling features without the overhead of maintaining boilerplate
@@ -12,15 +12,15 @@ error types.
1212

1313
[Documentation (crates.io)](https://docs.rs/error-chain).
1414

15-
[Documentation (master)](https://brson.github.io/error-chain).
15+
[Documentation (master)](https://rust-lang-nursery.github.io/error-chain).
1616

1717
## Quick start
1818

1919
If you just want to set up your new project with error-chain,
2020
follow the [quickstart.rs] template, and read this [intro]
2121
to error-chain.
2222

23-
[quickstart.rs]: https://github.com/brson/error-chain/blob/master/examples/quickstart.rs
23+
[quickstart.rs]: https://github.com/rust-lang-nursery/error-chain/blob/master/examples/quickstart.rs
2424
[intro]: http://brson.github.io/2016/11/30/starting-with-error-chain
2525

2626
## Supported Rust version

examples/quickstart.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ fn main() {
4646

4747
// The above main gives you maximum control over how the error is
4848
// formatted. If you don't care (i.e. you want to display the full
49-
// error during an assert) you can just call the `display` method
49+
// error during an assert) you can just call the `display_chain` method
5050
// on the error object
5151
#[allow(dead_code)]
5252
fn alternative_main() {
5353
if let Err(ref e) = run() {
5454
use std::io::Write;
55-
use error_chain::ChainedError; // trait which holds `display`
55+
use error_chain::ChainedError; // trait which holds `display_chain`
5656
let stderr = &mut ::std::io::stderr();
5757
let errmsg = "Error writing to stderr";
5858

59-
writeln!(stderr, "{}", e.display()).expect(errmsg);
59+
writeln!(stderr, "{}", e.display_chain()).expect(errmsg);
6060
::std::process::exit(1);
6161
}
6262
}

src/error_chain.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ macro_rules! error_chain_processed {
9696
self.kind()
9797
}
9898

99-
fn iter(&self) -> $crate::ErrorChainIter {
100-
$crate::ErrorChainIter(Some(self))
99+
fn iter(&self) -> $crate::Iter {
100+
$crate::Iter::new(Some(self))
101101
}
102102

103103
fn chain_err<F, EK>(self, error: F) -> Self
@@ -151,7 +151,7 @@ macro_rules! error_chain_processed {
151151
}
152152

153153
/// Iterates over the error chain.
154-
pub fn iter(&self) -> $crate::ErrorChainIter {
154+
pub fn iter(&self) -> $crate::Iter {
155155
$crate::ChainedError::iter(self)
156156
}
157157

@@ -172,6 +172,7 @@ macro_rules! error_chain_processed {
172172
self.0.description()
173173
}
174174

175+
#[allow(unknown_lints, unused_doc_comment)]
175176
fn cause(&self) -> Option<&::std::error::Error> {
176177
match self.1.next_error {
177178
Some(ref c) => Some(&**c),
@@ -423,6 +424,7 @@ macro_rules! impl_extract_backtrace {
423424
($error_name: ident
424425
$error_kind_name: ident
425426
$([$link_error_path: path, $(#[$meta_links: meta])*])*) => {
427+
#[allow(unknown_lints, unused_doc_comment)]
426428
fn extract_backtrace(e: &(::std::error::Error + Send + 'static))
427429
-> Option<::std::sync::Arc<$crate::Backtrace>> {
428430
if let Some(e) = e.downcast_ref::<$error_name>() {

0 commit comments

Comments
 (0)