File tree 3 files changed +12
-24
lines changed
3 files changed +12
-24
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ impl Error {
64
64
}
65
65
66
66
/// The type of an error that occurred while building an AST.
67
+ ///
68
+ /// This error type is marked as `non_exhaustive`. This means that adding a
69
+ /// new variant is not considered a breaking change.
70
+ #[ non_exhaustive]
67
71
#[ derive( Clone , Debug , Eq , PartialEq ) ]
68
72
pub enum ErrorKind {
69
73
/// The capturing group limit was exceeded.
@@ -168,13 +172,6 @@ pub enum ErrorKind {
168
172
/// `(?<!re)`. Note that all of these syntaxes are otherwise invalid; this
169
173
/// error is used to improve the user experience.
170
174
UnsupportedLookAround ,
171
- /// Hints that destructuring should not be exhaustive.
172
- ///
173
- /// This enum may grow additional variants, so this makes sure clients
174
- /// don't count on exhaustive matching. (Otherwise, adding a new variant
175
- /// could break existing code.)
176
- #[ doc( hidden) ]
177
- __Nonexhaustive,
178
175
}
179
176
180
177
impl std:: error:: Error for Error { }
@@ -270,7 +267,6 @@ impl fmt::Display for ErrorKind {
270
267
"look-around, including look-ahead and look-behind, \
271
268
is not supported"
272
269
) ,
273
- _ => unreachable ! ( ) ,
274
270
}
275
271
}
276
272
}
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ use crate::hir;
9
9
pub type Result < T > = result:: Result < T , Error > ;
10
10
11
11
/// This error type encompasses any error that can be returned by this crate.
12
+ ///
13
+ /// This error type is marked as `non_exhaustive`. This means that adding a
14
+ /// new variant is not considered a breaking change.
15
+ #[ non_exhaustive]
12
16
#[ derive( Clone , Debug , Eq , PartialEq ) ]
13
17
pub enum Error {
14
18
/// An error that occurred while translating concrete syntax into abstract
@@ -17,13 +21,6 @@ pub enum Error {
17
21
/// An error that occurred while translating abstract syntax into a high
18
22
/// level intermediate representation (HIR).
19
23
Translate ( hir:: Error ) ,
20
- /// Hints that destructuring should not be exhaustive.
21
- ///
22
- /// This enum may grow additional variants, so this makes sure clients
23
- /// don't count on exhaustive matching. (Otherwise, adding a new variant
24
- /// could break existing code.)
25
- #[ doc( hidden) ]
26
- __Nonexhaustive,
27
24
}
28
25
29
26
impl From < ast:: Error > for Error {
@@ -45,7 +42,6 @@ impl fmt::Display for Error {
45
42
match * self {
46
43
Error :: Parse ( ref x) => x. fmt ( f) ,
47
44
Error :: Translate ( ref x) => x. fmt ( f) ,
48
- _ => unreachable ! ( ) ,
49
45
}
50
46
}
51
47
}
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ impl Error {
52
52
}
53
53
54
54
/// The type of an error that occurred while building an `Hir`.
55
+ ///
56
+ /// This error type is marked as `non_exhaustive`. This means that adding a
57
+ /// new variant is not considered a breaking change.
58
+ #[ non_exhaustive]
55
59
#[ derive( Clone , Debug , Eq , PartialEq ) ]
56
60
pub enum ErrorKind {
57
61
/// This error occurs when a Unicode feature is used when Unicode
@@ -80,13 +84,6 @@ pub enum ErrorKind {
80
84
/// Note that this restriction in the translator may be removed in the
81
85
/// future.
82
86
EmptyClassNotAllowed ,
83
- /// Hints that destructuring should not be exhaustive.
84
- ///
85
- /// This enum may grow additional variants, so this makes sure clients
86
- /// don't count on exhaustive matching. (Otherwise, adding a new variant
87
- /// could break existing code.)
88
- #[ doc( hidden) ]
89
- __Nonexhaustive,
90
87
}
91
88
92
89
// BREADCRUMBS:
@@ -122,7 +119,6 @@ impl fmt::Display for ErrorKind {
122
119
(make sure the unicode-case feature is enabled)"
123
120
}
124
121
EmptyClassNotAllowed => "empty character classes are not allowed" ,
125
- __Nonexhaustive => unreachable ! ( ) ,
126
122
} ;
127
123
f. write_str ( msg)
128
124
}
You can’t perform that action at this time.
0 commit comments