@@ -49,11 +49,17 @@ pub type ParseResult<T> = Result<T, ParseError>;
49
49
macro_rules! simple_enum_error {
50
50
( $( $name: ident => $description: expr, ) +) => {
51
51
/// Errors that can occur during parsing.
52
+ ///
53
+ /// This may be extended in the future so exhaustive matching is
54
+ /// discouraged with an unused variant.
52
55
#[ derive( PartialEq , Eq , Clone , Copy , Debug ) ]
53
56
pub enum ParseError {
54
57
$(
55
58
$name,
56
59
) +
60
+ /// Unused variant enable non-exhaustive matching
61
+ #[ doc( hidden) ]
62
+ __FutureProof,
57
63
}
58
64
59
65
impl Error for ParseError {
@@ -62,6 +68,9 @@ macro_rules! simple_enum_error {
62
68
$(
63
69
ParseError :: $name => $description,
64
70
) +
71
+ ParseError :: __FutureProof => {
72
+ unreachable!( "Don't abuse the FutureProof!" ) ;
73
+ }
65
74
}
66
75
}
67
76
}
@@ -96,11 +105,17 @@ impl From<::idna::Errors> for ParseError {
96
105
macro_rules! syntax_violation_enum {
97
106
( $( $name: ident => $description: expr, ) +) => {
98
107
/// Non-fatal syntax violations that can occur during parsing.
108
+ ///
109
+ /// This may be extended in the future so exhaustive matching is
110
+ /// discouraged with an unused variant.
99
111
#[ derive( PartialEq , Eq , Clone , Copy , Debug ) ]
100
112
pub enum SyntaxViolation {
101
113
$(
102
114
$name,
103
115
) +
116
+ /// Unused variant enable non-exhaustive matching
117
+ #[ doc( hidden) ]
118
+ __FutureProof,
104
119
}
105
120
106
121
impl SyntaxViolation {
@@ -109,6 +124,9 @@ macro_rules! syntax_violation_enum {
109
124
$(
110
125
SyntaxViolation :: $name => $description,
111
126
) +
127
+ SyntaxViolation :: __FutureProof => {
128
+ unreachable!( "Don't abuse the FutureProof!" ) ;
129
+ }
112
130
}
113
131
}
114
132
}
0 commit comments